From patchwork Fri Jan 20 17:50:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijay Subramanian X-Patchwork-Id: 137059 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 52C571007D1 for ; Sat, 21 Jan 2012 04:52:00 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754462Ab2ATRv6 (ORCPT ); Fri, 20 Jan 2012 12:51:58 -0500 Received: from mail-iy0-f174.google.com ([209.85.210.174]:55441 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753889Ab2ATRv5 (ORCPT ); Fri, 20 Jan 2012 12:51:57 -0500 Received: by iaeh11 with SMTP id h11so610215iae.19 for ; Fri, 20 Jan 2012 09:51:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=jRIP2ByYrQT4jauNarC/ws4pR4YTR2mRkpMLl+g2DCA=; b=YmBc5pJwHU0uFY5Vcm0pL7s1J6MtKplI+z1vtrYKb5k+wqsWaa9Nq0+cU4JM5UjP6b lxAmMV3OTAlhPL2C03Ow5hNjVDSbmyhimp2jdHYdk8OGBkPZ8YnapEPzqN0Efhc/FXpj 6yIz4a1lyUHc3qwpHAgR7IrkRR/XJXiuDERGY= Received: by 10.43.47.135 with SMTP id us7mr27166549icb.31.1327081917064; Fri, 20 Jan 2012 09:51:57 -0800 (PST) Received: from localhost.localdomain (dhcp-128-107-165-178.cisco.com. [128.107.165.178]) by mx.google.com with ESMTPS id r18sm12172606ibh.4.2012.01.20.09.51.54 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 20 Jan 2012 09:51:55 -0800 (PST) From: Vijay Subramanian To: netdev@vger.kernel.org Cc: Stephen Hemminger , Vijay Subramanian Subject: [PATCH iproute2] netem: Fail cleanly if user input is wrong Date: Fri, 20 Jan 2012 09:50:25 -0800 Message-Id: <1327081825-6448-1-git-send-email-subramanian.vijay@gmail.com> X-Mailer: git-send-email 1.7.0.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org (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 --- 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;