[v4] dumpcap: fix select interface

Message ID 20221017120752.154761-1-arshdeep.kaur@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v4] dumpcap: fix select interface |

Checks

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

Commit Message

Kaur, Arshdeep Oct. 17, 2022, 12:07 p.m. UTC
  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(-)
  

Comments

Stephen Hemminger Oct. 17, 2022, 3:12 p.m. UTC | #1
On Mon, 17 Oct 2022 05:07:52 -0700
Arshdeep Kaur <arshdeep.kaur@intel.com> wrote:

> 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>

Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  
David Marchand Oct. 21, 2022, 1:01 p.m. UTC | #2
On Mon, Oct 17, 2022 at 5:12 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Mon, 17 Oct 2022 05:07:52 -0700
> Arshdeep Kaur <arshdeep.kaur@intel.com> wrote:
>
> > 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")
Cc: stable@dpdk.org

> >
> > Signed-off-by: Arshdeep Kaur <arshdeep.kaur@intel.com>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>

Applied, thanks.
  

Patch

diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index e0a3477d91..143c93940d 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_interfaces)
+		select_interface(interface_arg);
+
 	if (filter_str)
 		compile_filter();