[PATCH v2] app/pdump: exit if no device specified

fengchengwen fengchengwen at huawei.com
Mon Jul 3 08:29:20 CEST 2023


Acked-by: Chengwen Feng <fengchengwen at huawei.com>

On 2023/7/1 10:16, Stephen Hemminger wrote:
> Simpler version of earlier patch which had a good idea, was just
> implemented with more code than necessary.
> If no device is specified don't start the capture loop.
> 
> Reported-by: usman.tanveer <usman.tanveer at emumba.com>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
>  app/pdump/main.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/app/pdump/main.c b/app/pdump/main.c
> index c94606275b28..7a1c7bdf6011 100644
> --- a/app/pdump/main.c
> +++ b/app/pdump/main.c
> @@ -915,6 +915,9 @@ dump_packets(void)
>  	int i;
>  	unsigned int lcore_id = 0;
>  
> +	if (num_tuples == 0)
> +		rte_exit(EXIT_FAILURE, "No device specified for capture\n");
> +
>  	if (!multiple_core_capture) {
>  		printf(" core (%u), capture for (%d) tuples\n",
>  				rte_lcore_id(), num_tuples);
> 


More information about the dev mailing list