[PATCH 3/3] app/dumpcap: check for failure to set promiscious

Stephen Hemminger stephen at networkplumber.org
Fri Feb 11 00:09:06 CET 2022


If the rte_eth_promiscious_enable() fails, then log the error
and continue.

Coverity issue: 373662
Fixes: cbb44143be74 ("app/dumpcap: add new packet capture application")
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 app/dumpcap/main.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index c5fe4403028a..21cb2810a48f 100644
--- a/app/dumpcap/main.c
+++ b/app/dumpcap/main.c
@@ -679,8 +679,13 @@ static void enable_pdump(struct rte_ring *r, struct rte_mempool *mp)
 		flags |= RTE_PDUMP_FLAG_PCAPNG;
 
 	TAILQ_FOREACH(intf, &interfaces, next) {
-		if (promiscuous_mode)
-			rte_eth_promiscuous_enable(intf->port);
+		if (promiscuous_mode) {
+			ret = rte_eth_promiscuous_enable(intf->port);
+			if (ret != 0)
+				fprintf(stderr,
+					"port %u set promicious enable faile: %d\n",
+					intf->port, ret);
+		}
 
 		ret = rte_pdump_enable_bpf(intf->port, RTE_PDUMP_ALL_QUEUES,
 					   flags, snaplen,
-- 
2.34.1



More information about the dev mailing list