diff mbox

[iproute2] bond_slave: add help and fail on unknown opt

Message ID 1409903125-21200-1-git-send-email-jiri@resnulli.us
State Changes Requested, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Jiri Pirko Sept. 5, 2014, 7:45 a.m. UTC
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 ip/iplink_bond_slave.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Stephen Hemminger Sept. 28, 2014, 10:56 p.m. UTC | #1
On Fri,  5 Sep 2014 09:45:25 +0200
Jiri Pirko <jiri@resnulli.us> wrote:

> 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++;
>  	}

This patch does not apply. there is probably some earlier patch you forgot to send about
BOND_SLAVE_QUEUE_ID.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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++;
 	}