From b08e3e7460ba3dce6f32c1f4bff81ab2fa2bf40d Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Sun, 18 Dec 2022 07:15:03 +0100 Subject: [PATCH] dpdk: ips output cleanups --- src/runmode-dpdk.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/runmode-dpdk.c b/src/runmode-dpdk.c index 1b522628b6..082d7ad84d 100644 --- a/src/runmode-dpdk.c +++ b/src/runmode-dpdk.c @@ -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, ©_mode_str) | - ConfGetChildValueWithDefault( - if_root, if_default, dpdk_yaml.copy_iface, ©_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, ©_mode_str); + if (retval != 1) + SCReturnInt(-ENOENT); + if (retval < 0) + SCReturnInt(retval); + + retval = ConfGetChildValueWithDefault( + if_root, if_default, dpdk_yaml.copy_iface, ©_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); } -- 2.47.2