iproute2: bridge: add veb/vepa toggle
Subsystems (2)
RFC PATCH 1/1 iproute2: bridge: add veb/vepa toggle
Add bridge commands to set veb, vepa modes to iproute2.
[root@jf-dev1-dcblab iproute2]# ./bridge/bridge bridge show
eth2: mode VEB bridge_flags: self
eth3: mode VEPA bridge_flags: self
eth10: mode VEB bridge_flags: self
eth12: mode VEB bridge_flags: self
[root@jf-dev1-dcblab iproute2]# ./bridge/bridge bridge er mode veb dev eth3 self bridge_mode_set eth3: type 19 family 7 mode VEB flags 0002
[root@jf-dev1-dcblab iproute2]# ./bridge/bridge bridge show
eth2: mode VEB bridge_flags: self
eth3: mode VEB bridge_flags: self
eth10: mode VEB bridge_flags: self
eth12: mode VEB bridge_flags: self
Should add code to print the flags on error so the user can learn what failed. And maybe the cmd line syntax could be better.
---
bridge/br_common.h | 1 bridge/bridge.c | 3 bridge/fdb.c | 320 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/if_link.h | 16 ++ 4 files changed, 339 insertions(+), 1 deletions(-)
bridge/br_common.h +1 -0
@@ -5,6 +5,7 @@ extern int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg);extern int do_fdb (int argc,char **argv); +extern int do_bridge (int argc,char **argv);extern int do_monitor (int argc,char **argv);extern int preferred_family;
bridge/bridge.c +2 -1
@@ -27,7 +27,7 @@ static void usage(void) {fprintf (stderr,"Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }\n" -"where OBJECT := { fdb | monitor }\n" +"where OBJECT := { fdb | monitor | bridge }\n" " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails]\n" );exit (-1 ); }
@@ -43,6 +43,7 @@ static const struct cmd {int (*func)(int argc,char **argv); } cmds[] = { { "fdb", do_fdb }, + { "bridge", do_bridge }, { "monitor", do_monitor }, { "help", do_help }, { 0 }
bridge/fdb.c +320 -0
329 lines not on this page · raw message
include/linux/if_link.h +16 -0
@@ -142,6 +142,7 @@ enum {#define IFLA_PROMISCUITY IFLA_PROMISCUITYIFLA_NUM_TX_QUEUES ,IFLA_NUM_RX_QUEUES , +IFLA_BRIDGE , __IFLA_MAX };
@@ -375,6 +376,21 @@ enum {#define PORT_UUID_MAX 16#define PORT_SELF_VF -1 +/* Bridge Flags */ +#define BRIDGE_FLAGS_MASTER 1/* Bridge command to/from master */ +#define BRIDGE_FLAGS_SELF 2/* Bridge command to/from lowerdev */ + +#define BRIDGE_MODE_VEB 0/* Default loopback mode */ +#define BRIDGE_MODE_VEPA 1/* 802.1Qbg defined VEPA mode */ + +/* Bridge management nested attributes */ +enum { +IFLA_BRIDGE_FLAGS , +IFLA_BRIDGE_MODE , + __IFLA_BRIDGE_MAX, +}; +#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1) +enum {PORT_REQUEST_PREASSOCIATE =0 ,PORT_REQUEST_PREASSOCIATE_RR ,