When dumpcap adds an interface, the port was not being preserved. This
results in the structure being initialized and the port field being set
to 0 regardless of what port was actually selected. This unset field is
then used in both the enable and cleanup calls. This could result in the
capture occurring on the wrong interface.

Fixes: d59fb4d ("app/dumpcap: add new packet capture application")
Cc: step...@networkplumber.org
Cc: sta...@dpdk.org

Signed-off-by: Ben Magistro <konce...@gmail.com>
---
 app/dumpcap/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index b9096f050c..aaee9349b1 100644
--- a/app/dumpcap/main.c
+++ b/app/dumpcap/main.c
@@ -202,6 +202,7 @@ static void add_interface(uint16_t port, const char *name)
                rte_exit(EXIT_FAILURE, "no memory for interface\n");
 
        memset(intf, 0, sizeof(*intf));
+       intf->port = port;
        rte_strscpy(intf->name, name, sizeof(intf->name));
 
        printf("Capturing on '%s'\n", name);
-- 
2.27.0

Reply via email to