From: Nikolay Aleksandrov Date: Wed, 12 Aug 2015 16:19:06 +0000 (-0700) Subject: iplink: add support for IFLA_BR_VLAN_FILTERING attribute X-Git-Tag: v4.3.0~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4d456f0bb83ba926c380da8b865f145ece3944f;p=thirdparty%2Fiproute2.git iplink: add support for IFLA_BR_VLAN_FILTERING attribute This patch implements support for the IFLA_BR_VLAN_FILTERING attribute in iproute2 so it can enable/disable vlan_filtering. Example: $ ip link set br0 type bridge vlan_filtering 1 $ ip -d link show br0 6: br0: mtu 1500 qdisc noqueue state UP mode DEFAULT group default link/ether 08:00:27:ea:07:38 brd ff:ff:ff:ff:ff:ff promiscuity 0 bridge forward_delay 1500 hello_time 200 max_age 2000 vlan_filtering 1 addrgenmode eui64 Signed-off-by: Nikolay Aleksandrov --- diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c index e704e290c..a8bc84067 100644 --- a/ip/iplink_bridge.c +++ b/ip/iplink_bridge.c @@ -26,6 +26,7 @@ static void print_explain(FILE *f) " [ ageing_time AGEING_TIME ]\n" " [ stp_state STP_STATE ]\n" " [ priority PRIORITY ]\n" + " [ vlan_filtering VLAN_FILTERING ]\n" ); } @@ -84,6 +85,15 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, return -1; } addattr16(n, 1024, IFLA_BR_PRIORITY, prio); + } else if (matches(*argv, "vlan_filtering") == 0) { + __u8 vlan_filter; + + NEXT_ARG(); + if (get_u8(&vlan_filter, *argv, 0)) { + invarg("invalid vlan_filtering", *argv); + return -1; + } + addattr8(n, 1024, IFLA_BR_VLAN_FILTERING, vlan_filter); } else if (matches(*argv, "help") == 0) { explain(); return -1; @@ -126,6 +136,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) if (tb[IFLA_BR_PRIORITY]) fprintf(f, "priority %u ", rta_getattr_u16(tb[IFLA_BR_PRIORITY])); + + if (tb[IFLA_BR_VLAN_FILTERING]) + fprintf(f, "vlan_filtering %u ", + rta_getattr_u8(tb[IFLA_BR_VLAN_FILTERING])); } static void bridge_print_help(struct link_util *lu, int argc, char **argv,