app/flow-perf: fix parsing of invalid option

Currently, if an invalid parameter is passed to the application
it will cause a crash due to missing default in options.

For example:
        ./dpdk-test-flow-perf -a 01:00.0 -- --invalid

This adds missing default for options, and prints the
invalid option.

Fixes: 3344cf2e30 ("app/flow-perf: add flow performance skeleton")
Cc: stable@dpdk.org

Signed-off-by: Raslan Darawsheh <rasland@nvidia.com>
Acked-by: Wisam Jaddo <wisamm@nvidia.com>
This commit is contained in:
Raslan Darawsheh 2021-11-16 16:12:26 +02:00 committed by Thomas Monjalon
parent 71304b5c7b
commit 22ffcce31b

View File

@ -715,6 +715,7 @@ args_parse(int argc, char **argv)
{ "policy-mtr", 1, 0, 0 },
{ "meter-profile", 1, 0, 0 },
{ "packet-mode", 0, 0, 0 },
{ 0, 0, 0, 0 },
};
RTE_ETH_FOREACH_DEV(i)
@ -951,7 +952,7 @@ args_parse(int argc, char **argv)
default:
usage(argv[0]);
rte_exit(EXIT_FAILURE, "Invalid option: %s\n",
argv[optind]);
argv[optind - 1]);
break;
}
}