]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dpdk: ips output cleanups
authorVictor Julien <vjulien@oisf.net>
Sun, 18 Dec 2022 06:15:03 +0000 (07:15 +0100)
committerVictor Julien <vjulien@oisf.net>
Tue, 20 Dec 2022 07:51:33 +0000 (08:51 +0100)
src/runmode-dpdk.c

index 1b522628b6f18a586d939d3ca290b1873cff8a51..082d7ad84d0b220c52c5281bc51b7884e079bbee 100644 (file)
@@ -631,11 +631,6 @@ static int ConfigSetCopyIfaceSettings(DPDKIfaceConfig *iconf, const char *iface,
         SCReturnInt(-EINVAL);
     }
 
-    if (iconf->copy_mode == DPDK_COPY_MODE_IPS)
-        SCLogInfo("DPDK IPS mode activated between %s and %s", iconf->iface, iconf->out_iface);
-    else if (iconf->copy_mode == DPDK_COPY_MODE_TAP)
-        SCLogInfo("DPDK IPS mode activated between %s and %s", iconf->iface, iconf->out_iface);
-
     SCReturnInt(0);
 }
 
@@ -744,14 +739,20 @@ static int ConfigLoad(DPDKIfaceConfig *iconf, const char *iface)
     if (retval < 0)
         SCReturnInt(retval);
 
-    retval =
-            ConfGetChildValueWithDefault(if_root, if_default, dpdk_yaml.copy_mode, &copy_mode_str) |
-            ConfGetChildValueWithDefault(
-                    if_root, if_default, dpdk_yaml.copy_iface, &copy_iface_str);
-    // if one of copy interface settings fail to load then the default values are set
-    retval = retval != 1 ? ConfigSetCopyIfaceSettings(iconf, DPDK_CONFIG_DEFAULT_COPY_INTERFACE,
-                                   DPDK_CONFIG_DEFAULT_COPY_MODE)
-                         : ConfigSetCopyIfaceSettings(iconf, copy_iface_str, copy_mode_str);
+    retval = ConfGetChildValueWithDefault(if_root, if_default, dpdk_yaml.copy_mode, &copy_mode_str);
+    if (retval != 1)
+        SCReturnInt(-ENOENT);
+    if (retval < 0)
+        SCReturnInt(retval);
+
+    retval = ConfGetChildValueWithDefault(
+            if_root, if_default, dpdk_yaml.copy_iface, &copy_iface_str);
+    if (retval != 1)
+        SCReturnInt(-ENOENT);
+    if (retval < 0)
+        SCReturnInt(retval);
+
+    retval = ConfigSetCopyIfaceSettings(iconf, copy_iface_str, copy_mode_str);
     if (retval < 0)
         SCReturnInt(retval);
 
@@ -1174,6 +1175,13 @@ static int DeviceConfigureIPS(DPDKIfaceConfig *iconf)
             // Error will be written out by the validation function
             SCReturnInt(retval);
         }
+
+        if (iconf->copy_mode == DPDK_COPY_MODE_IPS)
+            SCLogInfo("%s: DPDK IPS mode activated: %s->%s", iconf->iface, iconf->iface,
+                    iconf->out_iface);
+        else if (iconf->copy_mode == DPDK_COPY_MODE_TAP)
+            SCLogInfo("%s: DPDK TAP mode activated: %s->%s", iconf->iface, iconf->iface,
+                    iconf->out_iface);
     }
     SCReturnInt(0);
 }