From patchwork Fri Sep 5 07:45:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 386173 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 D820914009C for ; Fri, 5 Sep 2014 17:45:35 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751828AbaIEHpa (ORCPT ); Fri, 5 Sep 2014 03:45:30 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:48486 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750835AbaIEHp3 (ORCPT ); Fri, 5 Sep 2014 03:45:29 -0400 Received: by mail-wi0-f171.google.com with SMTP id hi2so324689wib.10 for ; Fri, 05 Sep 2014 00:45:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ukWtUC9VABjCAzVQ48EGbISTXEj5SBziBnLWVTw77gU=; b=EC+bHa+7cftd/iPY5Ms9UQBo5n9iXKedFM/tZiHbedyqeetXyJAC8Qb+DvWMQo8l/f SyUgqky/Sf+tgbwCzh5KdLxKN6OcGmlEHtjCrvEpUXUfeG7HCc+wKzpVtpUWIA/9vvXX bT1VfDR18SX+WboYiVSTTev4QQ416bRRdVxsih4BRSWVFQ+ustSXSrrAMnhg+zhGDDIJ qOb5hbpNStEfFKtyVS2CVsCLSuFwjHZ8d7rgH/Lm6JdrHEm85rMaXTW55+ErXiiyH/EC ZeUsmGyBf0Vy2hUXrQYXXVjaSi55IvI4fJwH8mvuoOCgkQLQdWSlOuEzCCTNzubAjZ22 bWxA== X-Gm-Message-State: ALoCoQkmgSJKoQ1oyGMUqqh/QsXuR/UR1F23HXanACjbWLoHBFmqsMr/j6IqNvuRLx2ZplIk3xXr X-Received: by 10.180.186.10 with SMTP id fg10mr1604249wic.20.1409903128708; Fri, 05 Sep 2014 00:45:28 -0700 (PDT) Received: from localhost (ip-94-113-123-10.net.upcbroadband.cz. [94.113.123.10]) by mx.google.com with ESMTPSA id xn15sm1057412wib.13.2014.09.05.00.45.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Sep 2014 00:45:28 -0700 (PDT) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, stephen@networkplumber.org, nikolay@redhat.com Subject: [patch iproute2] bond_slave: add help and fail on unknown opt Date: Fri, 5 Sep 2014 09:45:25 +0200 Message-Id: <1409903125-21200-1-git-send-email-jiri@resnulli.us> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1409759850-15812-1-git-send-email-nikolay@redhat.com> References: <1409759850-15812-1-git-send-email-nikolay@redhat.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Jiri Pirko --- ip/iplink_bond_slave.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ip/iplink_bond_slave.c b/ip/iplink_bond_slave.c index aacba14..3c26f08 100644 --- a/ip/iplink_bond_slave.c +++ b/ip/iplink_bond_slave.c @@ -17,6 +17,13 @@ #include "utils.h" #include "ip_common.h" +static void explain(void) +{ + fprintf(stderr, + "Usage: ... bond_slave [ queue_id QUEUE_ID ]\n" + ); +} + static const char *slave_states[] = { [BOND_STATE_ACTIVE] = "ACTIVE", [BOND_STATE_BACKUP] = "BACKUP", @@ -91,6 +98,14 @@ static int bond_slave_parse_opt(struct link_util *lu, int argc, char **argv, if (get_u16(&queue_id, *argv, 0)) invarg("queue_id is invalid", *argv); addattr16(n, 1024, IFLA_BOND_SLAVE_QUEUE_ID, queue_id); + } else if (matches(*argv, "help") == 0) { + explain(); + return -1; + } else { + fprintf(stderr, "bond_slave: unknown option \"%s\"?\n", + *argv); + explain(); + return -1; } argc--, argv++; }