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

Message ID 20220210230906.833163-4-stephen@networkplumber.org (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series small fixes suggested by Coverity scan |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/github-robot: build success github build: passed
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Stephen Hemminger Feb. 10, 2022, 11:09 p.m. UTC
  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@networkplumber.org>
---
 app/dumpcap/main.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
  

Patch

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,