app/flow-perf: report invalid parameters
PATCH 1/1 app/flow-perf: report invalid parameters
Currently, there is no check if an invalid parameter is passed to the application.
for example:
./dpdk-test-flow-perf -a 01:00.0 -- --invalid
This validate that all strings are part of the known options.
--- app/test-flow-perf/main.c | 7 +++++++ 1 file changed, 7 insertions(+)
app/test-flow-perf/main.c +7 -0
@@ -885,6 +885,13 @@ args_parse(int argc, char **argv)break ; } } + +if (opt_idx != argc) { +usage (argv[0 ]); +rte_exit (EXIT_FAILURE , +"Incorrect command line %s\n" , argv[opt_idx]); + } +if (rules_count % rules_batch !=0 ) {rte_exit (EXIT_FAILURE ,"rules_count %% rules_batch should be 0\n" );
Signature · 1 line
2.25.1
PATCH v2 1/1 app/flow-perf: add missing default 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.
--- app/test-flow-perf/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
app/test-flow-perf/main.c +2 -1
@@ -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 ; } }
Signature · 1 line
2.25.1
RE: [PATCH v2] app/flow-perf: add missing default option
Hi,
Quoted 13 lines
-----Original Message-----
From: Raslan Darawsheh <[email protected]>
Sent: Tuesday, November 16, 2021 4:12 PM
To: [email protected]
Cc: Wisam Monther <[email protected]>; [email protected]
Subject: [PATCH v2] app/flow-perf: add missing default optionCurrently, 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
Quoted 7 lines
This adds missing default for options, and prints the invalid option.
Fixes 3344cf2e3001 ("app/flow-perf: add flow performance skeleton")Signed-off-by Raslan Darawsheh <[email protected]>
BRs,
Wisam Jaddo
Re: [PATCH v2] app/flow-perf: add missing default option
Quoted 6 lines
Quoted 6 lines
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
Quoted 8 lines
Quoted 7 lines
This adds missing default for options, and prints the invalid option.
Fixes 3344cf2e3001 ("app/flow-perf: add flow performance skeleton")Signed-off-by Raslan Darawsheh <[email protected]>Acked-by Wisam Jaddo <[email protected]>
Applied with title "fix parsing of invalid option", thanks.