* [PATCH] app/flow-perf: report invalid parameters
@ 2021-11-11 12:50 Raslan Darawsheh
2021-11-16 14:12 ` [PATCH v2] app/flow-perf: add missing default option Raslan Darawsheh
0 siblings, 1 reply; 4+ messages in thread
From: Raslan Darawsheh @ 2021-11-11 12:50 UTC (permalink / raw)
To: dev; +Cc: wisamm, stable
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.
Fixes: 3344cf2e3001 ("app/flow-perf: add flow performance skeleton")
Cc: wisamm@nvidia.com
Cc: stable@dpdk.org
Signed-off-by: Raslan Darawsheh <rasland@nvidia.com>
---
app/test-flow-perf/main.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index c1477b14a1..7453cf2b78 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -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");
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] app/flow-perf: add missing default option
2021-11-11 12:50 [PATCH] app/flow-perf: report invalid parameters Raslan Darawsheh
@ 2021-11-16 14:12 ` Raslan Darawsheh
2021-11-16 14:18 ` Wisam Monther
0 siblings, 1 reply; 4+ messages in thread
From: Raslan Darawsheh @ 2021-11-16 14:12 UTC (permalink / raw)
To: dev; +Cc: wisamm, stable
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: 3344cf2e3001 ("app/flow-perf: add flow performance skeleton")
Cc: wisamm@nvidia.com
Cc: stable@dpdk.org
Signed-off-by: Raslan Darawsheh <rasland@nvidia.com>
---
app/test-flow-perf/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 2b612aa32c..11f1ee0e1e 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -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;
}
}
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH v2] app/flow-perf: add missing default option
2021-11-16 14:12 ` [PATCH v2] app/flow-perf: add missing default option Raslan Darawsheh
@ 2021-11-16 14:18 ` Wisam Monther
2021-11-17 9:49 ` Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: Wisam Monther @ 2021-11-16 14:18 UTC (permalink / raw)
To: Raslan Darawsheh, dev; +Cc: stable
Hi,
> -----Original Message-----
> From: Raslan Darawsheh <rasland@nvidia.com>
> Sent: Tuesday, November 16, 2021 4:12 PM
> To: dev@dpdk.org
> Cc: Wisam Monther <wisamm@nvidia.com>; stable@dpdk.org
> Subject: [PATCH v2] 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.
>
> Fixes: 3344cf2e3001 ("app/flow-perf: add flow performance skeleton")
> Cc: wisamm@nvidia.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Raslan Darawsheh <rasland@nvidia.com>
Acked-by: Wisam Jaddo <wisamm@nvidia.com>
BRs,
Wisam Jaddo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] app/flow-perf: add missing default option
2021-11-16 14:18 ` Wisam Monther
@ 2021-11-17 9:49 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2021-11-17 9:49 UTC (permalink / raw)
To: Raslan Darawsheh; +Cc: dev, stable, Wisam Monther
> > 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: 3344cf2e3001 ("app/flow-perf: add flow performance skeleton")
> > Cc: wisamm@nvidia.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Raslan Darawsheh <rasland@nvidia.com>
> Acked-by: Wisam Jaddo <wisamm@nvidia.com>
Applied with title "fix parsing of invalid option", thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-17 9:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 12:50 [PATCH] app/flow-perf: report invalid parameters Raslan Darawsheh
2021-11-16 14:12 ` [PATCH v2] app/flow-perf: add missing default option Raslan Darawsheh
2021-11-16 14:18 ` Wisam Monther
2021-11-17 9:49 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).