[PATCH 4/6] app/dumpcap: fix capturing on multiple interfaces

Stephen Hemminger stephen at networkplumber.org
Wed Jan 4 04:01:29 CET 2023


On Mon,  2 Jan 2023 16:24:39 +0000
Ben Magistro <koncept1 at gmail.com> wrote:

> When selecting interfaces to capture traffic on, only the last interface
> specified was being preserved for selection. This turns the interface
> argument into an array allowing multiple interfaces to be selected.
> 
> This also adds checks for the capture format so that if multiple interfaces
> are selected, the interface information is included in the capture file.
> 
> Fixes: 7f3623a ("app/dumpcap: fix select interface")
> Cc: arshdeep.kaur at intel.com
> Cc: stephen at networkplumber.org
> Cc: stable at dpdk.org
> 
> Signed-off-by: Ben Magistro <koncept1 at gmail.com>
> ---
>  app/dumpcap/main.c | 47 +++++++++++++++++++++++++++++++++-------------
>  1 file changed, 34 insertions(+), 13 deletions(-)
> 
> diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
> index 26c641df61..dc4d69ff6b 100644
> --- a/app/dumpcap/main.c
> +++ b/app/dumpcap/main.c
> @@ -65,8 +65,8 @@ static const char *file_prefix;
>  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 uint8_t interface_arg_count = 0; /* count of interfaces configured via -i */
> +static const char *interface_arg[RTE_MAX_ETHPORTS]; /*array of interface parameters */

I think it is simpler to just use the existing interfaces
array rather than introducing a new data structure.

PS: run you patches through check patch, lots of little style issues
especially in #1


More information about the stable mailing list