netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 iproute2 0/3] Add support for bridge port link information
@ 2013-03-15 16:46 Vlad Yasevich
  2013-03-15 16:46 ` [PATCHv2 iproute2 1/3] bridge: Add support for setting bridge port attributes Vlad Yasevich
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vlad Yasevich @ 2013-03-15 16:46 UTC (permalink / raw)
  To: netdev; +Cc: shemminger, john.r.fastabend

Bridge ports provide unique link information about the properties and flags of
the port.  This patch set allows bridge utility to configure and disaplay
this information.

Please take a look at the man page text and let me know if you have anything
to add.

Sinve v1:
 - Change the link output to match link command line options as suggested by
   Stephen.
 - Add man page text.
 - Add root_block attribute.

Vlad Yasevich (3):
  bridge: Add support for setting bridge port attributes
  bridge: Add support for printing bridge port attributes
  man: Add documentation for the bridge link operation.

 bridge/br_common.h   |    1 +
 bridge/bridge.c      |    3 +-
 bridge/link.c        |  294 ++++++++++++++++++++++++++++++++++++++++++++++++-
 include/libnetlink.h |    2 +
 lib/libnetlink.c     |   13 ++-
 man/man8/bridge.8    |  136 +++++++++++++++++++++---
 6 files changed, 427 insertions(+), 22 deletions(-)

-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCHv2 iproute2 1/3] bridge: Add support for setting bridge port attributes
  2013-03-15 16:46 [PATCHv2 iproute2 0/3] Add support for bridge port link information Vlad Yasevich
@ 2013-03-15 16:46 ` Vlad Yasevich
  2013-03-15 16:46 ` [PATCHv2 iproute2 2/3] bridge: Add support for printing " Vlad Yasevich
  2013-03-15 16:46 ` [PATCHv2 iproute2 3/3] man: Add documentation for the bridge link operation Vlad Yasevich
  2 siblings, 0 replies; 4+ messages in thread
From: Vlad Yasevich @ 2013-03-15 16:46 UTC (permalink / raw)
  To: netdev; +Cc: shemminger, john.r.fastabend

Add netlink support bridge port attributes such as cost, priority, state
and flags.  This also adds support for HW mode such as VEPA or VEB.

Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
---
 bridge/br_common.h |    1 +
 bridge/bridge.c    |    3 +-
 bridge/link.c      |  217 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 220 insertions(+), 1 deletions(-)

diff --git a/bridge/br_common.h b/bridge/br_common.h
index 8764563..12fce3e 100644
--- a/bridge/br_common.h
+++ b/bridge/br_common.h
@@ -10,6 +10,7 @@ extern int do_fdb(int argc, char **argv);
 extern int do_mdb(int argc, char **argv);
 extern int do_monitor(int argc, char **argv);
 extern int do_vlan(int argc, char **argv);
+extern int do_link(int argc, char **argv);
 
 extern int preferred_family;
 extern int show_stats;
diff --git a/bridge/bridge.c b/bridge/bridge.c
index 06b7a54..77e260f 100644
--- a/bridge/bridge.c
+++ b/bridge/bridge.c
@@ -27,7 +27,7 @@ static void usage(void)
 {
 	fprintf(stderr,
 "Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }\n"
-"where  OBJECT := { fdb | mdb | vlan | monitor }\n"
+"where  OBJECT := { link | fdb | mdb | vlan | monitor }\n"
 "       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails]\n" );
 	exit(-1);
 }
@@ -42,6 +42,7 @@ static const struct cmd {
 	const char *cmd;
 	int (*func)(int argc, char **argv);
 } cmds[] = {
+	{ "link", 	do_link },
 	{ "fdb", 	do_fdb },
 	{ "mdb", 	do_mdb },
 	{ "vlan",	do_vlan },
diff --git a/bridge/link.c b/bridge/link.c
index edb6fbf..5811ee9 100644
--- a/bridge/link.c
+++ b/bridge/link.c
@@ -9,10 +9,14 @@
 #include <linux/if.h>
 #include <linux/if_bridge.h>
 #include <string.h>
+#include <stdbool.h>
 
+#include "libnetlink.h"
 #include "utils.h"
 #include "br_common.h"
 
+unsigned int filter_index;
+
 static const char *port_states[] = {
 	[BR_STATE_DISABLED] = "disabled",
 	[BR_STATE_LISTENING] = "listening",
@@ -87,6 +91,9 @@ int print_linkinfo(const struct sockaddr_nl *who,
 	if (!(ifi->ifi_family == AF_BRIDGE || ifi->ifi_family == AF_UNSPEC))
 		return 0;
 
+	if (filter_index && filter_index != ifi->ifi_index)
+		return 0;
+
 	parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len);
 
 	if (tb[IFLA_IFNAME] == NULL) {
@@ -136,3 +143,213 @@ int print_linkinfo(const struct sockaddr_nl *who,
 	fflush(fp);
 	return 0;
 }
+
+static void usage(void)
+{
+	fprintf(stderr, "Usage: bridge link set dev DEV [ cost COST ] [ priority PRIO ] [ state STATE ]\n");
+	fprintf(stderr, "                               [ guard {on | off} ]\n");
+	fprintf(stderr, "                               [ hairpin {on | off} ] \n");
+	fprintf(stderr, "                               [ fastleave {on | off} ]\n");
+	fprintf(stderr,	"                               [ root_block {on | off} ]\n");
+	fprintf(stderr, "                               [ hwmode {vepa | veb} ]\n");
+	fprintf(stderr, "       bridge link show [dev DEV]\n");
+	exit(-1);
+}
+
+static bool on_off(char *arg, __s8 *attr, char *val)
+{
+	if (strcmp(val, "on") == 0)
+		*attr = 1;
+	else if (strcmp(val, "off") == 0)
+		*attr = 0;
+	else {
+		fprintf(stderr,
+			"Error: argument of \"%s\" must be \"on\" or \"off\"\n",
+			arg);
+		return false;
+	}
+
+	return true;
+}
+
+static int brlink_modify(int argc, char **argv)
+{
+	struct {
+		struct nlmsghdr  n;
+		struct ifinfomsg ifm;
+		char             buf[512];
+	} req;
+	char *d = NULL;
+	__s8 hairpin = -1;
+	__s8 bpdu_guard = -1;
+	__s8 fast_leave = -1;
+	__u32 cost = 0;
+	__s16 priority = -1;
+	__s8 state = -1;
+	__s16 mode = -1;
+	__u16 flags = BRIDGE_FLAGS_MASTER;
+	struct rtattr *nest;
+
+	memset(&req, 0, sizeof(req));
+
+	req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
+	req.n.nlmsg_flags = NLM_F_REQUEST;
+	req.n.nlmsg_type = RTM_SETLINK;
+	req.ifm.ifi_family = PF_BRIDGE;
+
+	while (argc > 0) {
+		if (strcmp(*argv, "dev") == 0) {
+			NEXT_ARG();
+			d = *argv;
+		} else if (strcmp(*argv, "guard") == 0) {
+			NEXT_ARG();
+			if (!on_off("guard", &bpdu_guard, *argv))
+				exit(-1);
+		} else if (strcmp(*argv, "hairpin") == 0) {
+			NEXT_ARG();
+			if (!on_off("hairping", &hairpin, *argv))
+				exit(-1);
+		} else if (strcmp(*argv, "fastleave") == 0) {
+			NEXT_ARG();
+			if (!on_off("fastleave", &fast_leave, *argv))
+				exit(-1);
+		} else if (strcmp(*argv, "cost")) {
+			NEXT_ARG();
+			cost = atoi(*argv);
+		} else if (strcmp(*argv, "priority")) {
+			NEXT_ARG();
+			priority = atoi(*argv);
+		} else if (strcmp(*argv, "state")) {
+			NEXT_ARG();
+			state = atoi(*argv);
+		} else if (strcmp(*argv, "mode")) {
+			NEXT_ARG();
+			flags |= BRIDGE_FLAGS_SELF;
+			if (strcmp(*argv, "vepa") == 0)
+				mode = BRIDGE_MODE_VEPA;
+			else if (strcmp(*argv, "veb") == 0)
+				mode = BRIDGE_MODE_VEB;
+			else {
+				fprintf(stderr,
+					"Mode argument must be \"vepa\" or "
+					"\"veb\".\n");
+				exit(-1);
+			}
+		} else {
+			usage();
+		}
+		argc--; argv++;
+	}
+	if (d == NULL) {
+		fprintf(stderr, "Device is a required argument.\n");
+		exit(-1);
+	}
+
+
+	req.ifm.ifi_index = ll_name_to_index(d);
+	if (req.ifm.ifi_index == 0) {
+		fprintf(stderr, "Cannot find bridge device \"%s\"\n", d);
+		exit(-1);
+	}
+
+	/* Nested PROTINFO attribute.  Contains: port flags, cost, priority and
+	 * state.
+	 */
+	nest = addattr_nest(&req.n, sizeof(req),
+			    IFLA_PROTINFO | NLA_F_NESTED);
+	/* Flags first */
+	if (bpdu_guard >= 0)
+		addattr8(&req.n, sizeof(req), IFLA_BRPORT_GUARD, bpdu_guard);
+	if (hairpin >= 0)
+		addattr8(&req.n, sizeof(req), IFLA_BRPORT_MODE, hairpin);
+	if (fast_leave >= 0)
+		addattr8(&req.n, sizeof(req), IFLA_BRPORT_FAST_LEAVE,
+			 fast_leave);
+
+	if (cost > 0)
+		addattr32(&req.n, sizeof(req), IFLA_BRPORT_COST, cost);
+
+	if (priority >= 0)
+		addattr16(&req.n, sizeof(req), IFLA_BRPORT_PRIORITY, priority);
+
+	if (state >= 0)
+		addattr8(&req.n, sizeof(req), IFLA_BRPORT_STATE, state);
+
+	addattr_nest_end(&req.n, nest);
+
+	/* IFLA_AF_SPEC nested attribute.  Contains IFLA_BRIDGE_FLAGS that
+	 * designates master or self operation as well as 'vepa' or 'veb'
+	 * operation modes.  These are only valid in 'self' mode on some
+	 * devices so far.  Thus we only need to include the flags attribute
+	 * if we are setting the hw mode.
+	 */
+	if (mode >= 0) {
+		nest = addattr_nest(&req.n, sizeof(req), IFLA_AF_SPEC);
+
+		addattr16(&req.n, sizeof(req), IFLA_BRIDGE_FLAGS, flags);
+
+		if (mode >= 0)
+			addattr16(&req.n, sizeof(req), IFLA_BRIDGE_MODE, mode);
+
+		addattr_nest_end(&req.n, nest);
+	}
+
+	if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0)
+		exit(2);
+
+	return 0;
+}
+
+static int brlink_show(int argc, char **argv)
+{
+	char *filter_dev = NULL;
+
+	while (argc > 0) {
+		if (strcmp(*argv, "dev") == 0) {
+			NEXT_ARG();
+			if (filter_dev)
+				duparg("dev", *argv);
+			filter_dev = *argv;
+		}
+		argc--; argv++;
+	}
+
+	if (filter_dev) {
+		if ((filter_index = ll_name_to_index(filter_dev)) == 0) {
+			fprintf(stderr, "Cannot find device \"%s\"\n",
+				filter_dev);
+			return -1;
+		}
+	}
+
+	if (rtnl_wilddump_request(&rth, PF_BRIDGE, RTM_GETLINK) < 0) {
+		perror("Cannon send dump request");
+		exit(1);
+	}
+
+	if (rtnl_dump_filter(&rth, print_linkinfo, stdout) < 0) {
+		fprintf(stderr, "Dump terminated\n");
+		exit(1);
+	}
+	return 0;
+}
+
+int do_link(int argc, char **argv)
+{
+	ll_init_map(&rth);
+	if (argc > 0) {
+		if (matches(*argv, "set") == 0 ||
+		    matches(*argv, "change") == 0)
+			return brlink_modify(argc-1, argv+1);
+		if (matches(*argv, "show") == 0 ||
+		    matches(*argv, "lst") == 0 ||
+		    matches(*argv, "list") == 0)
+			return brlink_show(argc-1, argv+1);
+		if (matches(*argv, "help") == 0)
+			usage();
+	} else
+		return brlink_show(0, NULL);
+
+	fprintf(stderr, "Command \"%s\" is unknown, try \"bridge link help\".\n", *argv);
+	exit(-1);
+}
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCHv2 iproute2 2/3] bridge: Add support for printing bridge port attributes
  2013-03-15 16:46 [PATCHv2 iproute2 0/3] Add support for bridge port link information Vlad Yasevich
  2013-03-15 16:46 ` [PATCHv2 iproute2 1/3] bridge: Add support for setting bridge port attributes Vlad Yasevich
@ 2013-03-15 16:46 ` Vlad Yasevich
  2013-03-15 16:46 ` [PATCHv2 iproute2 3/3] man: Add documentation for the bridge link operation Vlad Yasevich
  2 siblings, 0 replies; 4+ messages in thread
From: Vlad Yasevich @ 2013-03-15 16:46 UTC (permalink / raw)
  To: netdev; +Cc: shemminger, john.r.fastabend

Output new nested bridge port attributes.

Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
---
 bridge/link.c        |   79 +++++++++++++++++++++++++++++++++++++++++++++----
 include/libnetlink.h |    2 +
 lib/libnetlink.c     |   13 +++++++-
 3 files changed, 85 insertions(+), 9 deletions(-)

diff --git a/bridge/link.c b/bridge/link.c
index 5811ee9..6b53833 100644
--- a/bridge/link.c
+++ b/bridge/link.c
@@ -65,6 +65,8 @@ static const char *oper_states[] = {
 	"TESTING", "DORMANT",	 "UP"
 };
 
+static const char *hw_mode[] = {"VEB", "VEPA"};
+
 static void print_operstate(FILE *f, __u8 state)
 {
 	if (state >= sizeof(oper_states)/sizeof(oper_states[0]))
@@ -73,6 +75,27 @@ static void print_operstate(FILE *f, __u8 state)
 		fprintf(f, "state %s ", oper_states[state]);
 }
 
+static void print_portstate(FILE *f, __u8 state)
+{
+	if (state <= BR_STATE_BLOCKING)
+		fprintf(f, "state %s ", port_states[state]);
+	else
+		fprintf(f, "state (%d) ", state);
+}
+
+static void print_onoff(FILE *f, char *flag, __u8 val)
+{
+	fprintf(f, "%s %s ", flag, val ? "on" : "off");
+}
+
+static void print_hwmode(FILE *f, __u16 mode)
+{
+	if (mode >= sizeof(hw_mode)/sizeof(hw_mode[0]))
+		fprintf(f, "hwmode %#hx ", mode);
+	else
+		fprintf(f, "hwmode %s ", hw_mode[mode]);
+}
+
 int print_linkinfo(const struct sockaddr_nl *who,
 		   struct nlmsghdr *n, void *arg)
 {
@@ -94,7 +117,7 @@ int print_linkinfo(const struct sockaddr_nl *who,
 	if (filter_index && filter_index != ifi->ifi_index)
 		return 0;
 
-	parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len);
+	parse_rtattr_flags(tb, IFLA_MAX, IFLA_RTA(ifi), len, NLA_F_NESTED);
 
 	if (tb[IFLA_IFNAME] == NULL) {
 		fprintf(stderr, "BUG: nil ifname\n");
@@ -131,13 +154,48 @@ int print_linkinfo(const struct sockaddr_nl *who,
 			if_indextoname(rta_getattr_u32(tb[IFLA_MASTER]), b1));
 
 	if (tb[IFLA_PROTINFO]) {
-		__u8 state = rta_getattr_u8(tb[IFLA_PROTINFO]);
-		if (state <= BR_STATE_BLOCKING)
-			fprintf(fp, "state %s", port_states[state]);
-		else
-			fprintf(fp, "state (%d)", state);
+		if (tb[IFLA_PROTINFO]->rta_type & NLA_F_NESTED) {
+			struct rtattr *prtb[IFLA_BRPORT_MAX+1];
+
+			parse_rtattr_nested(prtb, IFLA_BRPORT_MAX,
+					    tb[IFLA_PROTINFO]);
+
+			if (prtb[IFLA_BRPORT_STATE])
+				print_portstate(fp,
+						rta_getattr_u8(prtb[IFLA_BRPORT_STATE]));
+			if (prtb[IFLA_BRPORT_PRIORITY])
+				fprintf(fp, "priority %hu ",
+					rta_getattr_u16(prtb[IFLA_BRPORT_PRIORITY]));
+			if (prtb[IFLA_BRPORT_COST])
+				fprintf(fp, "cost %u ",
+					rta_getattr_u32(prtb[IFLA_BRPORT_COST]));
+			if (prtb[IFLA_BRPORT_MODE])
+				print_onoff(fp, "hairpin",
+					    rta_getattr_u8(prtb[IFLA_BRPORT_MODE]));
+			if (prtb[IFLA_BRPORT_GUARD])
+				print_onoff(fp, "guard",
+					    rta_getattr_u8(prtb[IFLA_BRPORT_GUARD]));
+			if (prtb[IFLA_BRPORT_PROTECT])
+				print_onoff(fp, "root_block",
+					    rta_getattr_u8(prtb[IFLA_BRPORT_PROTECT]));
+			if (prtb[IFLA_BRPORT_FAST_LEAVE])
+				print_onoff(fp, "fastleave",
+					    rta_getattr_u8(prtb[IFLA_BRPORT_FAST_LEAVE]));
+		} else
+			print_portstate(fp, rta_getattr_u8(tb[IFLA_PROTINFO]));
 	}
 
+	if (tb[IFLA_AF_SPEC]) {
+		/* This is reported by HW devices that have some bridging
+		 * capabilities.
+		 */
+		struct rtattr *aftb[IFLA_BRIDGE_MAX+1];
+
+		parse_rtattr_nested(aftb, IFLA_BRIDGE_MAX, tb[IFLA_AF_SPEC]);
+
+		if (tb[IFLA_BRIDGE_MODE])
+			print_hwmode(fp, rta_getattr_u16(tb[IFLA_BRIDGE_MODE]));
+	}
 
 	fprintf(fp, "\n");
 	fflush(fp);
@@ -183,6 +241,7 @@ static int brlink_modify(int argc, char **argv)
 	__s8 hairpin = -1;
 	__s8 bpdu_guard = -1;
 	__s8 fast_leave = -1;
+	__s8 root_block = -1;
 	__u32 cost = 0;
 	__s16 priority = -1;
 	__s8 state = -1;
@@ -213,6 +272,10 @@ static int brlink_modify(int argc, char **argv)
 			NEXT_ARG();
 			if (!on_off("fastleave", &fast_leave, *argv))
 				exit(-1);
+		} else if (strcmp(*argv, "root_block") == 0) {
+			NEXT_ARG();
+			if (!on_off("root_block", &root_block, *argv))
+				exit(-1);
 		} else if (strcmp(*argv, "cost")) {
 			NEXT_ARG();
 			cost = atoi(*argv);
@@ -222,7 +285,7 @@ static int brlink_modify(int argc, char **argv)
 		} else if (strcmp(*argv, "state")) {
 			NEXT_ARG();
 			state = atoi(*argv);
-		} else if (strcmp(*argv, "mode")) {
+		} else if (strcmp(*argv, "hwmode")) {
 			NEXT_ARG();
 			flags |= BRIDGE_FLAGS_SELF;
 			if (strcmp(*argv, "vepa") == 0)
@@ -265,6 +328,8 @@ static int brlink_modify(int argc, char **argv)
 	if (fast_leave >= 0)
 		addattr8(&req.n, sizeof(req), IFLA_BRPORT_FAST_LEAVE,
 			 fast_leave);
+	if (root_block >= 0)
+		addattr8(&req.n, sizeof(req), IFLA_BRPORT_PROTECT, root_block);
 
 	if (cost > 0)
 		addattr32(&req.n, sizeof(req), IFLA_BRPORT_COST, cost);
diff --git a/include/libnetlink.h b/include/libnetlink.h
index 8d15ee5..ec3d657 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -65,6 +65,8 @@ extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data);
 extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type, const void *data, int alen);
 
 extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
+extern int parse_rtattr_flags(struct rtattr *tb[], int max, struct rtattr *rta,
+			      int len, unsigned short flags);
 extern int parse_rtattr_byindex(struct rtattr *tb[], int max, struct rtattr *rta, int len);
 extern int __parse_rtattr_nested_compat(struct rtattr *tb[], int max, struct rtattr *rta, int len);
 
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 67f046f..f262959 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -658,10 +658,19 @@ int rta_addattr_l(struct rtattr *rta, int maxlen, int type,
 
 int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len)
 {
+	return parse_rtattr_flags(tb, max, rta, len, 0);
+}
+
+int parse_rtattr_flags(struct rtattr *tb[], int max, struct rtattr *rta,
+		       int len, unsigned short flags)
+{
+	unsigned short type;
+
 	memset(tb, 0, sizeof(struct rtattr *) * (max + 1));
 	while (RTA_OK(rta, len)) {
-		if ((rta->rta_type <= max) && (!tb[rta->rta_type]))
-			tb[rta->rta_type] = rta;
+		type = rta->rta_type & ~flags;
+		if ((type <= max) && (!tb[type]))
+			tb[type] = rta;
 		rta = RTA_NEXT(rta,len);
 	}
 	if (len)
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCHv2 iproute2 3/3] man: Add documentation for the bridge link operation.
  2013-03-15 16:46 [PATCHv2 iproute2 0/3] Add support for bridge port link information Vlad Yasevich
  2013-03-15 16:46 ` [PATCHv2 iproute2 1/3] bridge: Add support for setting bridge port attributes Vlad Yasevich
  2013-03-15 16:46 ` [PATCHv2 iproute2 2/3] bridge: Add support for printing " Vlad Yasevich
@ 2013-03-15 16:46 ` Vlad Yasevich
  2 siblings, 0 replies; 4+ messages in thread
From: Vlad Yasevich @ 2013-03-15 16:46 UTC (permalink / raw)
  To: netdev; +Cc: shemminger, john.r.fastabend

Bridge tool now supports setting and retrieving bridge port specific
link attributes.  Document what attributes are supported and what
they mean.

Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
---
 man/man8/bridge.8 |  136 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 123 insertions(+), 13 deletions(-)

diff --git a/man/man8/bridge.8 b/man/man8/bridge.8
index d34e3cf..cad93ed 100644
--- a/man/man8/bridge.8
+++ b/man/man8/bridge.8
@@ -13,13 +13,36 @@ bridge \- show / manipulate bridge addresses and devices
 
 .ti -8
 .IR OBJECT " := { "
-.BR fdb " | " vlan " | " monitor " }"
+.BR link " | " fdb " | " vlan " | " monitor " }"
 .sp
 
 .ti -8
 .IR OPTIONS " := { "
 \fB\-V\fR[\fIersion\fR] |
-\fB\-s\fR[\fItatistics\fR]
+\fB\-s\fR[\fItatistics\fR] }
+
+.ti -8
+.BR "bridge link set"
+.B  dev
+.IR DEV
+.IR " [ "
+.B  cost
+.IR COST " ] [ "
+.B  priority
+.IR PRIO " ]  [ "
+.B  state
+.IR STATE "] ["
+.BR guard " { " on " | " off " } ] [ "
+.BR hairpin " { " on " | " off " } ] [ "
+.BR fastleave " { " on " | " off " } ] [ "
+.BR root_block " { " on " | " off " } ] [ "
+.BR hwmode " { " vepa " | " veb " } ] [ "
+.BR self " ]  [ " master " ] "
+
+.ti -8
+.BR "bridge link" " [ " show " ] [ "
+.B  dev
+.IR DEV " ]"
 
 .ti -8
 .BR "bridge fdb" " { " add " | " del " } "
@@ -72,6 +95,10 @@ As a rule, the information is statistics or some time values.
 .I OBJECT
 
 .TP
+.B link
+- Bridge port.
+
+.TP
 .B fdb 
 - Forwarding Database entry.
 
@@ -102,6 +129,100 @@ Usually it is
 or, if the objects of this class cannot be listed,
 .BR "help" .
 
+.SH bridge link - bridge port
+
+.B link
+objects correspond to the port devices of the bridge.
+
+.P
+The corresponding commands set and display port status and bridge specific
+attributes.
+
+.SS bridge link set - set bridge specific attributes on a port
+
+.TP
+.BI dev " NAME "
+interface name of the bridge port
+
+.TP
+.BI cost " COST "
+the STP path cost of the specified port.
+
+.TP
+.BI priority " PRIO "
+the STP port priority.  The priority value is an unsigned 8-bit quantity
+(number between 0 and 255).  This metric is used in the designated port an
+droot port selectio algorithms.
+
+.TP
+.BI state " STATE "
+the operation state of the port.  This is primarily used by user space STP/RSTP
+implementation.  The following is a list of valid values:
+
+.B 0
+- port is DISABLED.  Make this port completely inactive.
+.sp
+
+.B 1
+- STP LISTENING state.  Only valid if STP is enabled on the brige.  In this
+state the port for list for STP BPDUs and drop all other traffic.
+.sp
+
+.B 2
+- STP LEARNING state.  Only valid if STP is enabled on the bridge.  In this
+state the port will accept traffic only for the purpose of updating MAC
+adress tables.
+.sp
+
+.B 3
+- STP FORWARDING state.  Port is fully active.
+.sp
+
+.B 4
+- STP BLOCKING state.  Only valid if STP is eanbled on the bridge.  This state
+is used during the STP election process.  In this state, port will only process
+STP BPDUs.
+.sp
+
+.TP
+.BR "guard on " or " guard off "
+Controls whether STP BPUDs will be processed by the bridge port.  By default,
+the flag is turned off allowed BPDU processing.  Turning this flag on will
+cause the port to stop processing STP BPDUs.
+
+.TP
+.BR "hairpin on " or " hairpin off "
+Controls whether traffic may be send back out of the port on which it was
+received.  By default, this flag is turned off and the bridge will not forward
+traffic back out of the receiving port.
+
+.TP
+.BR "fastleave on " or " fastleave off "
+This flag allows the bridge to immediately stop multicast traffic on a port
+that recieves IGMP Leave message.  It is only used with IGMP snooping is
+enabled on the bridge.  By default the flag is off.
+
+.TP
+.BR "root_block on " or " root_block off "
+Controls whether a given port is allowed to become root port or not.  Only used
+when STP is enabled on the bridge.  By default the flag is off.
+
+.TP
+.BI hwmode
+Some network interface cards support HW bridge functionality and they may be
+configured in different modes.  Currently support modes are:
+
+.B vepa
+- Data sent between HW ports is sent on the wire to the external
+switch.
+
+.B veb
+- bridging happens in hardware.
+
+.SS bridge link show - list bridge port configuration.
+
+This command displays the current bridge port configuration and flags.
+
 .SH bridge fdb - forwarding database management
 
 .B fdb
@@ -123,17 +244,6 @@ the Ethernet MAC address.
 .BI dev " NAME"
 the interface to which this address is associated.
 
-.TP
-.in +8
-.B local
-- the address is associated with a local interface on the system
-and is never forwarded.
-.sp
-
-.B temp
-- the address is a dynamic entry, and will be removed if not used.
-.sp
-
 .B self
 - the address is associated with a software fdb (default)
 .sp
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-15 16:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-15 16:46 [PATCHv2 iproute2 0/3] Add support for bridge port link information Vlad Yasevich
2013-03-15 16:46 ` [PATCHv2 iproute2 1/3] bridge: Add support for setting bridge port attributes Vlad Yasevich
2013-03-15 16:46 ` [PATCHv2 iproute2 2/3] bridge: Add support for printing " Vlad Yasevich
2013-03-15 16:46 ` [PATCHv2 iproute2 3/3] man: Add documentation for the bridge link operation Vlad Yasevich

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).