refactor packet IO, rename dumpfile mode to pcap mode, modify related configuration

This commit is contained in:
luwenpeng
2024-08-30 10:21:44 +08:00
parent 8935e5408b
commit d1d5e6e09e
16 changed files with 544 additions and 512 deletions

View File

@@ -3,15 +3,13 @@ snowflake_base = 1 # [0, 31]
snowflake_offset = 2 # [0, 127]
[packet_io]
mode = "dumpfile" # dumpfile, dumpfilelist, marsio
mode = "pcapfile" # pcapfile, pcaplist, marsio
app_symbol = "stellar"
dev_symbol = "nf_0_fw"
dumpfile_path = "/tmp/dumpfile/dumpfile.pcap"
#dumpfile_path = "/tmp/dumpfile/dumpfilelist"
nr_worker_thread = 1 # [1, 256]
pcap_path = "/tmp/test.pcap"
nr_worker_thread = 1 # range: [1, 256]
cpu_mask = [5]
idle_yield_interval_ms = 900 # range: [0, 60000] (ms)
[ip_reassembly]
enable = 1
@@ -67,5 +65,3 @@ tcp_reassembly_max_segments = 128 # range: [2, 4096]
[schedule]
merge_stat_interval = 50 # range: [1, 60000] (ms)
output_stat_interval = 2000 # range: [1, 60000] (ms)
packet_io_yield_interval = 900 # range: [1, 60000] (ms)

View File

@@ -145,8 +145,8 @@ static inline void expect_cmp_inject(const char *expect_pcap_file, const char *i
static inline void packet_inject_test(struct packet_inject_case *test)
{
// create directory
char dumpfile_path[PATH_MAX] = {0};
snprintf(dumpfile_path, sizeof(dumpfile_path), "%s/input/%s", test->work_dir, test->input_pcap);
char pcap_path[PATH_MAX] = {0};
snprintf(pcap_path, sizeof(pcap_path), "%s/input/%s", test->work_dir, test->input_pcap);
system_cmd("rm -rf %s", test->work_dir);
system_cmd("mkdir -p %s/input/", test->work_dir);
system_cmd("mkdir -p %s/log/", test->work_dir);
@@ -173,9 +173,9 @@ static inline void packet_inject_test(struct packet_inject_case *test)
char temp[PATH_MAX * 2] = {0};
getcwd(cwd, sizeof(cwd));
chdir(test->work_dir);
snprintf(temp, sizeof(temp), "dumpfile_path = \"%s\"", dumpfile_path);
EXPECT_TRUE(replace_file_string("./conf/stellar.toml", "mode = marsio", "mode = dumpfile") == 0);
EXPECT_TRUE(replace_file_string("./conf/stellar.toml", "dumpfile_path = \"/tmp/dumpfile/dumpfile.pcap\"", temp) == 0);
snprintf(temp, sizeof(temp), "pcap_path = \"%s\"", pcap_path);
EXPECT_TRUE(replace_file_string("./conf/stellar.toml", "mode = marsio", "mode = pcapfile") == 0);
EXPECT_TRUE(replace_file_string("./conf/stellar.toml", "pcap_path = \"/tmp/test.pcap\"", temp) == 0);
const char *stellar_cfg_file = "./conf/stellar.toml";
const char *plugin_cfg_file = "./plugin/spec.toml";