capture: improve IDS + IPS check

Improve it for af-packet, dpdk, netmap. Check would not consider
an interface IDS if the `default` section contained a copy-mode
field.
pull/10921/head
Victor Julien 2 years ago committed by Victor Julien
parent bb59124063
commit 58bff9b855

@ -90,7 +90,6 @@ static int AFPRunModeIsIPS(void)
SCLogError("Problem with config file"); SCLogError("Problem with config file");
return 0; return 0;
} }
const char *copymodestr = NULL;
if_root = ConfFindDeviceConfig(af_packet_node, live_dev); if_root = ConfFindDeviceConfig(af_packet_node, live_dev);
if (if_root == NULL) { if (if_root == NULL) {
@ -101,7 +100,10 @@ static int AFPRunModeIsIPS(void)
if_root = if_default; if_root = if_default;
} }
if (ConfGetChildValueWithDefault(if_root, if_default, "copy-mode", &copymodestr) == 1) { const char *copymodestr = NULL;
const char *copyifacestr = NULL;
if (ConfGetChildValueWithDefault(if_root, if_default, "copy-mode", &copymodestr) == 1 &&
ConfGetChildValue(if_root, "copy-iface", &copyifacestr) == 1) {
if (strcmp(copymodestr, "ips") == 0) { if (strcmp(copymodestr, "ips") == 0) {
has_ips = 1; has_ips = 1;
} else { } else {

@ -1663,7 +1663,9 @@ static int DPDKRunModeIsIPS(void)
} }
const char *copymodestr = NULL; const char *copymodestr = NULL;
if (ConfGetChildValueWithDefault(if_root, if_default, "copy-mode", &copymodestr) == 1) { const char *copyifacestr = NULL;
if (ConfGetChildValueWithDefault(if_root, if_default, "copy-mode", &copymodestr) == 1 &&
ConfGetChildValue(if_root, "copy-iface", &copyifacestr) == 1) {
if (strcmp(copymodestr, "ips") == 0) { if (strcmp(copymodestr, "ips") == 0) {
has_ips = true; has_ips = true;
} else { } else {

@ -81,7 +81,6 @@ static int NetmapRunModeIsIPS(void)
SCLogError("Problem with config file"); SCLogError("Problem with config file");
return 0; return 0;
} }
const char *copymodestr = NULL;
if_root = ConfNodeLookupKeyValue(netmap_node, "interface", live_dev); if_root = ConfNodeLookupKeyValue(netmap_node, "interface", live_dev);
if (if_root == NULL) { if (if_root == NULL) {
@ -92,7 +91,10 @@ static int NetmapRunModeIsIPS(void)
if_root = if_default; if_root = if_default;
} }
if (ConfGetChildValueWithDefault(if_root, if_default, "copy-mode", &copymodestr) == 1) { const char *copymodestr = NULL;
const char *copyifacestr = NULL;
if (ConfGetChildValueWithDefault(if_root, if_default, "copy-mode", &copymodestr) == 1 &&
ConfGetChildValue(if_root, "copy-iface", &copyifacestr) == 1) {
if (strcmp(copymodestr, "ips") == 0) { if (strcmp(copymodestr, "ips") == 0) {
has_ips = 1; has_ips = 1;
} else { } else {

Loading…
Cancel
Save