From: Vijay Subramanian Date: Fri, 20 Jan 2012 17:50:25 +0000 (-0800) Subject: netem: Fail cleanly if user input is wrong X-Git-Tag: v3.3.0~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14a1c164d12e32415acc44ef566fcf52ff4dd113;p=thirdparty%2Fiproute2.git netem: Fail cleanly if user input is wrong (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 --- diff --git a/tc/q_netem.c b/tc/q_netem.c index cb0c8a4f6..360080ca9 100644 --- a/tc/q_netem.c +++ b/tc/q_netem.c @@ -426,6 +426,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;