netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] netem: Fail cleanly if user input is wrong
@ 2012-01-20 17:50 Vijay Subramanian
  2012-01-20 19:22 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Vijay Subramanian @ 2012-01-20 17:50 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger, Vijay Subramanian

(Resending patch since it looks like my earlier mail did not make it to
netdev). 

netem reordering requires that the delay parameter be given. Currently, if no
delay is given, tc prints the error message but still installs the qdisc. Fix
this by printing the usage and failing cleanly.

Signed-off-by: Vijay Subramanian <subramanian.vijay@gmail.com>
---
 tc/q_netem.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tc/q_netem.c b/tc/q_netem.c
index b1fd452..23164d9 100644
--- a/tc/q_netem.c
+++ b/tc/q_netem.c
@@ -395,6 +395,8 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 	if (reorder.probability) {
 		if (opt.latency == 0) {
 			fprintf(stderr, "reordering not possible without specifying some delay\n");
+			explain();
+			return -1;
 		}
 		if (opt.gap == 0)
 			opt.gap = 1;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2] netem: Fail cleanly if user input is wrong
  2012-01-20 17:50 [PATCH iproute2] netem: Fail cleanly if user input is wrong Vijay Subramanian
@ 2012-01-20 19:22 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2012-01-20 19:22 UTC (permalink / raw)
  To: Vijay Subramanian; +Cc: netdev

On Fri, 20 Jan 2012 09:50:25 -0800
Vijay Subramanian <subramanian.vijay@gmail.com> wrote:

> (Resending patch since it looks like my earlier mail did not make it to
> netdev). 
> 
> netem reordering requires that the delay parameter be given. Currently, if no
> delay is given, tc prints the error message but still installs the qdisc. Fix
> this by printing the usage and failing cleanly.
> 
> Signed-off-by: Vijay Subramanian <subramanian.vijay@gmail.com>
> ---
>  tc/q_netem.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/tc/q_netem.c b/tc/q_netem.c
> index b1fd452..23164d9 100644
> --- a/tc/q_netem.c
> +++ b/tc/q_netem.c
> @@ -395,6 +395,8 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
>  	if (reorder.probability) {
>  		if (opt.latency == 0) {
>  			fprintf(stderr, "reordering not possible without specifying some delay\n");
> +			explain();
> +			return -1;
>  		}
>  		if (opt.gap == 0)
>  			opt.gap = 1;

Applied

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-20 19:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-20 17:50 [PATCH iproute2] netem: Fail cleanly if user input is wrong Vijay Subramanian
2012-01-20 19:22 ` Stephen Hemminger

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).