From patchwork Mon Sep 22 13:52:36 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcela Maslanova X-Patchwork-Id: 876 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.176.167]) by ozlabs.org (Postfix) with ESMTP id 4D369DDD04 for ; Mon, 22 Sep 2008 23:52:41 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752162AbYIVNwf (ORCPT ); Mon, 22 Sep 2008 09:52:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752109AbYIVNwf (ORCPT ); Mon, 22 Sep 2008 09:52:35 -0400 Received: from mx2.redhat.com ([66.187.237.31]:47758 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752131AbYIVNwe (ORCPT ); Mon, 22 Sep 2008 09:52:34 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id m8MDqYoe031590; Mon, 22 Sep 2008 09:52:34 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m8MDqXAn006811; Mon, 22 Sep 2008 09:52:33 -0400 Received: from caladan.englab.brq.redhat.com (caladan.englab.brq.redhat.com [10.34.32.66]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id m8MDqVaV011424; Mon, 22 Sep 2008 09:52:32 -0400 Message-ID: <48D7A324.3050401@redhat.com> Date: Mon, 22 Sep 2008 15:52:36 +0200 From: Marcela Maslanova User-Agent: Thunderbird 2.0.0.16 (X11/20080723) MIME-Version: 1.0 To: shemminger@vyatta.com CC: netdev@vger.kernel.org Subject: [PATCH] IPROUTE: tc correct error message X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This warning message was removed in change 083a5f00a15f6506815b0da2be82e7be761c5cbc In this patch is checked, whether warning should be printed. Output of "tc filter help" isn't spoiled after my change. From e007577ef506671896857808634f3326d69b5072 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Mon, 22 Sep 2008 15:41:04 +0200 Subject: [PATCH] tc error message: protocol is needed. This message was removed in change 083a5f00a15f6506815b0da2be82e7be761c5cbc but now it's checked, whether it should be print and don't spoil help messages. --- tc/tc_filter.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/tc/tc_filter.c b/tc/tc_filter.c index 177446e..ce30dd9 100644 --- a/tc/tc_filter.c +++ b/tc/tc_filter.c @@ -120,7 +120,9 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv) if (parse_estimator(&argc, &argv, &est) < 0) return -1; } else if (matches(*argv, "help") == 0) { + protocol_set = 1; usage(); + return 0; } else { strncpy(k, *argv, sizeof(k)-1); @@ -128,7 +130,6 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv) argc--; argv++; break; } - argc--; argv++; } @@ -153,6 +154,11 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv) return -1; } } + if (!protocol_set) { + fprintf(stderr, "\"protocol\" is required.\n"); + return -1; + } + if (est.ewma_log) addattr_l(&req.n, sizeof(req), TCA_RATE, &est, sizeof(est)); -- 1.5.5.2