diff mbox

[iproute2,net-next,2/2] iplink: bridge: add support for IFLA_BR_VLAN_FILTERING attribute

Message ID 1439297784-1962-3-git-send-email-razor@blackwall.org
State Accepted, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Nikolay Aleksandrov Aug. 11, 2015, 12:56 p.m. UTC
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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 <nikolay@cumulusnetworks.com>
---
 include/linux/if_link.h |  1 +
 ip/iplink_bridge.c      | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

Comments

Stephen Hemminger Aug. 12, 2015, 4:21 p.m. UTC | #1
On Tue, 11 Aug 2015 15:56:24 +0300
Nikolay Aleksandrov <razor@blackwall.org> wrote:

> From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
> 
> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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 <nikolay@cumulusnetworks.com>

Applied.
Please update man page as well.


--
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
Nikolay Aleksandrov Aug. 12, 2015, 6:42 p.m. UTC | #2
> On Aug 12, 2015, at 7:21 PM, Stephen Hemminger <stephen@networkplumber.org> wrote:
> 
> On Tue, 11 Aug 2015 15:56:24 +0300
> Nikolay Aleksandrov <razor@blackwall.org> wrote:
> 
>> From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
>> 
>> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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 <nikolay@cumulusnetworks.com>
> 
> Applied.
> Please update man page as well.

Hi Stephen,
I looked into the man page update while making the patch but I didn’t find bridge specific attributes anywhere and
so I thought that section hasn’t been added yet. Anyway, I have plans to add it and describe all of the currently
supported attributes plus the ones I plan to post patches for soon.

Cheers,
 Nik--
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/include/linux/if_link.h b/include/linux/if_link.h
index fa66d2bb3388..4f0a558e8fcf 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -228,6 +228,7 @@  enum {
 	IFLA_BR_AGEING_TIME,
 	IFLA_BR_STP_STATE,
 	IFLA_BR_PRIORITY,
+	IFLA_BR_VLAN_FILTERING,
 	__IFLA_BR_MAX,
 };
 
diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c
index 2a0bf6e147d0..eeee71c98a93 100644
--- a/ip/iplink_bridge.c
+++ b/ip/iplink_bridge.c
@@ -26,6 +26,7 @@  static void explain(void)
 		"                  [ ageing_time AGEING_TIME ]\n"
 		"                  [ stp_state STP_STATE ]\n"
 		"                  [ priority PRIORITY ]\n"
+		"                  [ vlan_filtering VLAN_FILTERING ]\n"
 	);
 }
 
@@ -79,6 +80,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;
@@ -121,6 +131,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]));
 }
 
 struct link_util bridge_link_util = {