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.

(cherry picked from commit 58bff9b855)
pull/10927/head
Victor Julien 2 years ago
parent 8b1dcbd5e3
commit b8739ea13f

@ -90,7 +90,6 @@ static int AFPRunModeIsIPS(void)
SCLogError("Problem with config file");
return 0;
}
const char *copymodestr = NULL;
if_root = ConfFindDeviceConfig(af_packet_node, live_dev);
if (if_root == NULL) {
@ -101,7 +100,10 @@ static int AFPRunModeIsIPS(void)
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) {
has_ips = 1;
} else {

@ -1646,7 +1646,9 @@ static int DPDKRunModeIsIPS(void)
}
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) {
has_ips = true;
} else {

@ -81,7 +81,6 @@ static int NetmapRunModeIsIPS(void)
SCLogError("Problem with config file");
return 0;
}
const char *copymodestr = NULL;
if_root = ConfNodeLookupKeyValue(netmap_node, "interface", live_dev);
if (if_root == NULL) {
@ -92,7 +91,10 @@ static int NetmapRunModeIsIPS(void)
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) {
has_ips = 1;
} else {

Loading…
Cancel
Save