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 6F737A00C2;
	Fri, 14 Oct 2022 22:50:25 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 114C7400D4;
	Fri, 14 Oct 2022 22:50:24 +0200 (CEST)
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by mails.dpdk.org (Postfix) with ESMTP id F050C4003C
 for <dev@dpdk.org>; Fri, 14 Oct 2022 22:50:21 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1665780622; x=1697316622;
 h=from:to:subject:date:message-id:in-reply-to:references:
 mime-version:content-transfer-encoding;
 bh=uTQKYtAp+CuppdJZiCwJEI+uRJ9Mm8whUyY5+PTBp9U=;
 b=NGgzBLeS3DkR6dI4vK5ROJPmKR5pBjoSOLdH5NWylbC5XzXyBa6cyzkH
 DZ0GaE04NsKV7ChNsOgHNvjl/kwIctq8dQMzyhj0Vycnjd7r0tyu/5dpK
 JSg2JOfQRxvYdtMfKp1/NmOo61tMk+3AGdXSyt4HJRN/mLk044DAT2wBW
 CsD3Fx1VlE362NMQN33mtfddeT5lHvtYTaN9I6lCUePC3KyEiBQ4asMoT
 txMouqOMTjEmm9bm94k0NMswT5gt273nsFDfYRLtrrZ+Wtxxt1eB/bUZd
 L5cd8Dk9GvaZKPwHHJ8kOeO89uWjiqg3b7+4tu30aSmvt2ZMXQzIMvd17 A==;
X-IronPort-AV: E=McAfee;i="6500,9779,10500"; a="304209655"
X-IronPort-AV: E=Sophos;i="5.95,185,1661842800"; d="scan'208";a="304209655"
Received: from orsmga007.jf.intel.com ([10.7.209.58])
 by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 14 Oct 2022 13:50:20 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=McAfee;i="6500,9779,10500"; a="622653221"
X-IronPort-AV: E=Sophos;i="5.95,185,1661842800"; d="scan'208";a="622653221"
Received: from unknown (HELO skx-5gnr-sd6.localdomain) ([10.233.180.92])
 by orsmga007.jf.intel.com with ESMTP; 14 Oct 2022 13:50:20 -0700
From: Arshdeep Kaur <arshdeep.kaur@intel.com>
To: dev@dpdk.org
Subject: [PATCH v2] dumpcap: fix select interface
Date: Fri, 14 Oct 2022 13:48:54 -0700
Message-Id: <20221014204854.36106-1-arshdeep.kaur@intel.com>
X-Mailer: git-send-email 2.37.1
In-Reply-To: <20221014203325.32418-1-arshdeep.kaur@intel.com>
References: <20221014203325.32418-1-arshdeep.kaur@intel.com>
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

The change to do argument process before EAL init broke
the support of select-interface option. Fix by setting flag
and doing select-interface later.

Fixes: a8dde09f97df ("app/dumpcap: allow help/version without primary process")

Signed-off-by: Arshdeep Kaur <arshdeep.kaur@intel.com>
---
 app/dumpcap/main.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index e0a3477d91..11a44ecce4 100644
--- a/app/dumpcap/main.c
+++ b/app/dumpcap/main.c
@@ -64,6 +64,8 @@ static const char *capture_comment;
 static uint32_t snaplen = RTE_MBUF_DEFAULT_BUF_SIZE;
 static bool dump_bpf;
 static bool show_interfaces;
+static bool select_interfaces;
+const char *interface_arg;
 
 static struct {
 	uint64_t  duration;	/* nanoseconds */
@@ -370,7 +372,8 @@ static void parse_opts(int argc, char **argv)
 			usage();
 			exit(0);
 		case 'i':
-			select_interface(optarg);
+			select_interfaces = true;
+			interface_arg = optarg;
 			break;
 		case 'n':
 			use_pcapng = true;
@@ -796,6 +799,9 @@ int main(int argc, char **argv)
 	if (rte_eth_dev_count_avail() == 0)
 		rte_exit(EXIT_FAILURE, "No Ethernet ports found\n");
 
+	if (select_interface)
+		select_interface(interface_arg);
+
 	if (filter_str)
 		compile_filter();
 
-- 
2.37.1