netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
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	[thread overview]
Message-ID: <1409903125-21200-1-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1409759850-15812-1-git-send-email-nikolay@redhat.com>

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 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++;
 	}
-- 
1.9.3

  parent reply	other threads:[~2014-09-05  7:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03 14:43 [PATCH net-next iproute2] iproute2: allow to change slave options via type_slave Nikolay Aleksandrov
2014-09-03 15:02 ` Jiri Pirko
2014-09-03 15:57   ` [PATCH net-next iproute2 v2] " Nikolay Aleksandrov
2014-09-03 16:04     ` Jiri Pirko
2014-09-05  7:45     ` Jiri Pirko [this message]
2014-09-28 22:56       ` [patch iproute2] bond_slave: add help and fail on unknown opt Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409903125-21200-1-git-send-email-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@redhat.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).