From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 34157A00C2;
	Wed,  4 Jan 2023 04:38:25 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 23F6942D14;
	Wed,  4 Jan 2023 04:38:22 +0100 (CET)
Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com
 [209.85.216.43]) by mails.dpdk.org (Postfix) with ESMTP id 15691410EA
 for <dev@dpdk.org>; Wed,  4 Jan 2023 04:38:20 +0100 (CET)
Received: by mail-pj1-f43.google.com with SMTP id
 o1-20020a17090a678100b00219cf69e5f0so37761682pjj.2
 for <dev@dpdk.org>; Tue, 03 Jan 2023 19:38:19 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20210112.gappssmtp.com; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Ex5rV++63MUgg7vuwjiHzkM6W+NgA72iBtEK3leuCfM=;
 b=Uzf8cRO/ac1+8yiZQZ92034eMyeuT18bb0HeNK4BTya5wHFsj7aUvi3c2UcNPtiLmV
 3o0harlJonxZBjYwiUYcMwPptU4779p7MlhWmGVNWbh/mc4imDomZgvpfjZN65HPTJYT
 KZCJIPT3Tf3emAXj/GlSPl0duBBRZ/ajCiR1prt3elzdKJk7juKaS+PtvI0HJIHn8vEp
 b6CyXqsUq1DCJW7WzGxd/k2yBJhF9Ucr02RaOLabx7uajVfdEZFuODwL3fWFh6jP+fmr
 Cbu3skP1/AjnmBjpUo+VJqTyrmSBifcNY5N2GIFgNu1NDZ+rEi665SOrEcaOl7uHalA+
 hIVg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=Ex5rV++63MUgg7vuwjiHzkM6W+NgA72iBtEK3leuCfM=;
 b=Pd2KnRLXTcaCheivoeJZFcLV2DDC+z2Fh2BjZJCkGX9el7LaZiCmhXDsScHiCmStGF
 CjHHTBbAw/+GcxjAKJ+YLRQkWeqWhh/40XH4xm+KeIXyph+4u994mfRr3TeJ83CMm2KM
 qoB0acFZ9z4IYeXzLL34xxzUid4AuYy2+qPoNzvBj7DnfydYtIwFhXaG9xPqGNsO7f4C
 HAehdJ5fPDa0wfWtfm0h/oVrdMuo84LxHLI5LjH3eBGaaGUNvUlRW05WVdwr8B+WBVB1
 zPKpIABUoZ+sPIC1LO+6EPRJ6wH41jFRURMzqEUoPZ4wLpKIb8tjo8hUhyED1UIGvnuF
 YtIQ==
X-Gm-Message-State: AFqh2kpPMhpVvSKapnfUCedYEr8xgPKVmYJoN9KScY4F+NiPou57aABb
 HU7tBx9C0n99hnrPUkRYXh5H9YVm2D5DoeNvfFQ=
X-Google-Smtp-Source: AMrXdXvpk5NV+7tfjM29BPp5lj+HO/CutccaIu+gODZtOrUpNOxUl6XvgTRmG6A0VXdPqsTN7ClDsQ==
X-Received: by 2002:a17:902:e74d:b0:189:6d2f:4bcd with SMTP id
 p13-20020a170902e74d00b001896d2f4bcdmr61920274plf.0.1672803499165; 
 Tue, 03 Jan 2023 19:38:19 -0800 (PST)
Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218])
 by smtp.gmail.com with ESMTPSA id
 c10-20020a170903234a00b0017f73caf588sm23091347plh.218.2023.01.03.19.38.17
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 03 Jan 2023 19:38:18 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ben Magistro <koncept1@gmail.com>
Cc: dev@dpdk.org,
	stephen@networkplumber.org,
	stable@dpdk.org
Subject: [PATCH v2 1/6] app/dumpcap: fix storing port identifier
Date: Tue,  3 Jan 2023 19:38:10 -0800
Message-Id: <20230104033815.35496-2-stephen@networkplumber.org>
X-Mailer: git-send-email 2.39.0
In-Reply-To: <20230104033815.35496-1-stephen@networkplumber.org>
References: <20230102162441.6205-1-koncept1@gmail.com>
 <20230104033815.35496-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

From: Ben Magistro <koncept1@gmail.com>

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: stephen@networkplumber.org
Cc: stable@dpdk.org

Signed-off-by: Ben Magistro <koncept1@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/dumpcap/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index 2eb8414efaa5..4751ca26b892 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.39.0