CleanupPcapFileThreadVars(ptv);
SCReturnInt(TM_ECODE_OK);
}
+ pv->cur_dir_depth = 0;
+
+ int should_recurse;
+ pv->should_recurse = false;
+ if (ConfGetBool("pcap-file.recursive", &should_recurse) == 1) {
+ pv->should_recurse = (should_recurse == 1);
+ }
int should_loop = 0;
pv->should_loop = false;
if (ConfGetBool("pcap-file.continuous", &should_loop) == 1) {
- pv->should_loop = should_loop == 1;
+ pv->should_loop = (should_loop == 1);
+ }
+
+ if (pv->should_recurse == true && pv->should_loop == true) {
+ SCLogError(SC_ERR_INVALID_ARGUMENT, "Error, --pcap-file-continuous and --pcap-file-recursive "
+ "cannot be used together.");
+ SCReturnInt(TM_ECODE_FAILED);
}
pv->delay = 30;
printf("\t--pcap[=<dev>] : run in pcap mode, no value select interfaces from suricata.yaml\n");
printf("\t--pcap-file-continuous : when running in pcap mode with a directory, continue checking directory for pcaps until interrupted\n");
printf("\t--pcap-file-delete : when running in replay mode (-r with directory or file), will delete pcap files that have been processed when done\n");
+ printf("\t--pcap-file-recursive : will descend into subdirectories when running in replay mode (-r)\n");
#ifdef HAVE_PCAP_SET_BUFF
printf("\t--pcap-buffer-size : size of the pcap buffer value from 0 - %i\n",INT_MAX);
#endif /* HAVE_SET_PCAP_BUFF */
{"pcap", optional_argument, 0, 0},
{"pcap-file-continuous", 0, 0, 0},
{"pcap-file-delete", 0, 0, 0},
+ {"pcap-file-recursive", 0, 0, 0},
{"simulate-ips", 0, 0 , 0},
{"no-random", 0, &g_disable_randomness, 1},
{"strict-rule-keywords", optional_argument, 0, 0},
return TM_ECODE_FAILED;
}
}
+ else if (strcmp((long_opts[option_index]).name, "pcap-file-recursive") == 0) {
+ if (ConfSetFinal("pcap-file.recursive", "true") != 1) {
+ SCLogError(SC_ERR_CMD_LINE, "ERROR: Failed to set pcap-file.recursive");
+ return TM_ECODE_FAILED;
+ }
+ }
else if (strcmp((long_opts[option_index]).name, "data-dir") == 0) {
if (optarg == NULL) {
SCLogError(SC_ERR_INITIALIZATION, "no option argument (optarg) for -d");