|
|
049c96 |
From f1041556927a428d05b7349a1abe5eaf6af50575 Mon Sep 17 00:00:00 2001
|
|
|
049c96 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
049c96 |
Date: Wed, 24 Feb 2016 10:49:05 +0100
|
|
|
049c96 |
Subject: [PATCH] iplink: shortify printing the usage of link type
|
|
|
049c96 |
|
|
|
049c96 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1270759
|
|
|
049c96 |
Upstream Status: iproute2.git commit a560d850d9cd2
|
|
|
049c96 |
|
|
|
049c96 |
commit a560d850d9cd24b06281897c97eb6afef3f00d8b
|
|
|
049c96 |
Author: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
|
|
|
049c96 |
Date: Wed Aug 12 06:03:24 2015 +0000
|
|
|
049c96 |
|
|
|
049c96 |
iplink: shortify printing the usage of link type
|
|
|
049c96 |
|
|
|
049c96 |
Allow to print link type usage by: ip link help bridge_slave
|
|
|
049c96 |
|
|
|
049c96 |
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
|
|
|
049c96 |
---
|
|
|
049c96 |
ip/iplink_bridge_slave.c | 16 ++++++++++++++--
|
|
|
049c96 |
1 file changed, 14 insertions(+), 2 deletions(-)
|
|
|
049c96 |
|
|
|
049c96 |
diff --git a/ip/iplink_bridge_slave.c b/ip/iplink_bridge_slave.c
|
|
|
049c96 |
index a285185..4593872 100644
|
|
|
049c96 |
--- a/ip/iplink_bridge_slave.c
|
|
|
049c96 |
+++ b/ip/iplink_bridge_slave.c
|
|
|
049c96 |
@@ -19,9 +19,9 @@
|
|
|
049c96 |
#include "utils.h"
|
|
|
049c96 |
#include "ip_common.h"
|
|
|
049c96 |
|
|
|
049c96 |
-static void explain(void)
|
|
|
049c96 |
+static void print_explain(FILE *f)
|
|
|
049c96 |
{
|
|
|
049c96 |
- fprintf(stderr,
|
|
|
049c96 |
+ fprintf(f,
|
|
|
049c96 |
"Usage: ... bridge_slave [ state STATE ] [ priority PRIO ] [cost COST ]\n"
|
|
|
049c96 |
" [ guard {on | off} ]\n"
|
|
|
049c96 |
" [ hairpin {on | off} ] \n"
|
|
|
049c96 |
@@ -32,6 +32,11 @@ static void explain(void)
|
|
|
049c96 |
);
|
|
|
049c96 |
}
|
|
|
049c96 |
|
|
|
049c96 |
+static void explain(void)
|
|
|
049c96 |
+{
|
|
|
049c96 |
+ print_explain(stderr);
|
|
|
049c96 |
+}
|
|
|
049c96 |
+
|
|
|
049c96 |
static const char *port_states[] = {
|
|
|
049c96 |
[BR_STATE_DISABLED] = "disabled",
|
|
|
049c96 |
[BR_STATE_LISTENING] = "listening",
|
|
|
049c96 |
@@ -172,10 +177,17 @@ static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv,
|
|
|
049c96 |
return 0;
|
|
|
049c96 |
}
|
|
|
049c96 |
|
|
|
049c96 |
+static void bridge_slave_print_help(struct link_util *lu, int argc, char **argv,
|
|
|
049c96 |
+ FILE *f)
|
|
|
049c96 |
+{
|
|
|
049c96 |
+ print_explain(f);
|
|
|
049c96 |
+}
|
|
|
049c96 |
+
|
|
|
049c96 |
struct link_util bridge_slave_link_util = {
|
|
|
049c96 |
.id = "bridge",
|
|
|
049c96 |
.maxattr = IFLA_BRPORT_MAX,
|
|
|
049c96 |
.print_opt = bridge_slave_print_opt,
|
|
|
049c96 |
.parse_opt = bridge_slave_parse_opt,
|
|
|
049c96 |
+ .print_help = bridge_slave_print_help,
|
|
|
049c96 |
.slave = true,
|
|
|
049c96 |
};
|
|
|
049c96 |
--
|
|
|
049c96 |
1.8.3.1
|
|
|
049c96 |
|