Skip to contentSkip to conversation

add latest bridge netlink options

PATCH Superseded Hangbin Liu 2 participants 12 messages Jan 17, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover add latest bridge netlink options

Add the bridge netlink attributes added to kernel recently.

Hangbin Liu (5):
iplink: bridge: add support for IFLA_BR_FDB_FLUSH
iplink: bridge: add support for IFLA_BR_VLAN_STATS_ENABLED
iplink: bridge: add support for IFLA_BR_MCAST_STATS_ENABLED
iplink: bridge: add support for IFLA_BR_MCAST_IGMP_VERSION
iplink: bridge: add support for IFLA_BR_MCAST_MLD_VERSION

 ip/iplink_bridge.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 56 insertions(+), 1 deletion(-)
Signature · 1 line
2.5.5
#1 lore raw

PATCH 1/5 iplink: bridge: add support for IFLA_BR_FDB_FLUSH

This patch implements support for the IFLA_BR_FDB_FLUSH attribute in iproute2 so it can flush bridge fdb dynamic entries.

---
 ip/iplink_bridge.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
ip/iplink_bridge.c +4 -1
index d2d4202..85e6597 100644
@@ -22,7 +22,8 @@
 static void print_explain(FILE *f)
 {
 	fprintf(f,
-		"Usage: ... bridge [ forward_delay FORWARD_DELAY ]\n"
+		"Usage: ... bridge [ fdb_flush ]\n"
+		"                  [ forward_delay FORWARD_DELAY ]\n"
 		"                  [ hello_time HELLO_TIME ]\n"
 		"                  [ max_age MAX_AGE ]\n"
 		"                  [ ageing_time AGEING_TIME ]\n"
@@ -145,6 +146,8 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
 			if (len < 0)
 				return -1;
 			addattr_l(n, 1024, IFLA_BR_GROUP_ADDR, llabuf, len);
+		} else if (matches(*argv, "fdb_flush") == 0) {
+			addattr(n, 1024, IFLA_BR_FDB_FLUSH);
 		} else if (matches(*argv, "vlan_default_pvid") == 0) {
 			__u16 default_pvid;
 
Signature · 1 line
2.5.5
#9 lore raw

PATCH 5/5 iplink: bridge: add support for IFLA_BR_MCAST_MLD_VERSION

In reply to Hangbin Liu

This patch implements support for the IFLA_BR_MCAST_MLD_VERSION attribute in iproute2 so it can change the mcast mld version.

---
 ip/iplink_bridge.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
ip/iplink_bridge.c +13 -0
index 6611a85..f484d05 100644
@@ -51,6 +51,7 @@ static void print_explain(FILE *f)
 		"                  [ mcast_startup_query_interval STARTUP_QUERY_INTERVAL ]\n"
 		"                  [ mcast_state MCAST_STATE ]\n"
 		"                  [ mcast_igmp_version IGMP_VERSION ]\n"
+		"                  [ mcast_mld_version MLD_VERSION ]\n"
 		"                  [ nf_call_iptables NF_CALL_IPTABLES ]\n"
 		"                  [ nf_call_ip6tables NF_CALL_IP6TABLES ]\n"
 		"                  [ nf_call_arptables NF_CALL_ARPTABLES ]\n"
@@ -317,6 +318,14 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
 				invarg("invalid mcast_igmp_version", *argv);
 			addattr8(n, 1024, IFLA_BR_MCAST_IGMP_VERSION,
 				  igmp_version);
+		} else if (matches(*argv, "mcast_mld_version") == 0) {
+			__u8 mld_version;
+
+			NEXT_ARG();
+			if (get_u8(&mld_version, *argv, 0))
+				invarg("invalid mcast_mld_version", *argv);
+			addattr8(n, 1024, IFLA_BR_MCAST_MLD_VERSION,
+				  mld_version);
 		} else if (matches(*argv, "nf_call_iptables") == 0) {
 			__u8 nf_call_ipt;
 
@@ -550,6 +559,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 		fprintf(f, "mcast_igmp_version %u ",
 			rta_getattr_u8(tb[IFLA_BR_MCAST_IGMP_VERSION]));
 
+	if (tb[IFLA_BR_MCAST_MLD_VERSION])
+		fprintf(f, "mcast_mld_version %u ",
+			rta_getattr_u8(tb[IFLA_BR_MCAST_MLD_VERSION]));
+
 	if (tb[IFLA_BR_NF_CALL_IPTABLES])
 		fprintf(f, "nf_call_iptables %u ",
 			rta_getattr_u8(tb[IFLA_BR_NF_CALL_IPTABLES]));
Signature · 1 line
2.5.5
#5 lore raw

PATCH 3/5 iplink: bridge: add support for IFLA_BR_MCAST_STATS_ENABLED

In reply to Hangbin Liu

This patch implements support for the IFLA_BR_MCAST_STATS_ENABLED attribute in iproute2 so it can change the mcast state.

---
 ip/iplink_bridge.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
ip/iplink_bridge.c +13 -0
index 8caf53a..622bd07 100644
@@ -49,6 +49,7 @@ static void print_explain(FILE *f)
 		"                  [ mcast_query_interval QUERY_INTERVAL ]\n"
 		"                  [ mcast_query_response_interval QUERY_RESPONSE_INTERVAL ]\n"
 		"                  [ mcast_startup_query_interval STARTUP_QUERY_INTERVAL ]\n"
+		"                  [ mcast_state MCAST_STATE ]\n"
 		"                  [ nf_call_iptables NF_CALL_IPTABLES ]\n"
 		"                  [ nf_call_ip6tables NF_CALL_IP6TABLES ]\n"
 		"                  [ nf_call_arptables NF_CALL_ARPTABLES ]\n"
@@ -299,6 +300,14 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
 
 			addattr64(n, 1024, IFLA_BR_MCAST_STARTUP_QUERY_INTVL,
 				  mcast_startup_query_intvl);
+		} else if (matches(*argv, "mcast_state") == 0) {
+			__u8 mcast_state;
+
+			NEXT_ARG();
+			if (get_u8(&mcast_state, *argv, 0))
+				invarg("invalid mcast_state", *argv);
+			addattr8(n, 1024, IFLA_BR_MCAST_STATS_ENABLED,
+				  mcast_state);
 		} else if (matches(*argv, "nf_call_iptables") == 0) {
 			__u8 nf_call_ipt;
 
@@ -524,6 +533,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 		fprintf(f, "mcast_startup_query_interval %llu ",
 			rta_getattr_u64(tb[IFLA_BR_MCAST_STARTUP_QUERY_INTVL]));
 
+	if (tb[IFLA_BR_MCAST_STATS_ENABLED])
+		fprintf(f, "mcast_state %u ",
+			rta_getattr_u8(tb[IFLA_BR_MCAST_STATS_ENABLED]));
+
 	if (tb[IFLA_BR_NF_CALL_IPTABLES])
 		fprintf(f, "nf_call_iptables %u ",
 			rta_getattr_u8(tb[IFLA_BR_NF_CALL_IPTABLES]));
Signature · 1 line
2.5.5
#3 lore raw

PATCH 2/5 iplink: bridge: add support for IFLA_BR_VLAN_STATS_ENABLED

In reply to Hangbin Liu

This patch implements support for the IFLA_BR_VLAN_STATS_ENABLED attribute in iproute2 so it can change the vlan state.

---
 ip/iplink_bridge.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
ip/iplink_bridge.c +13 -0
index 85e6597..8caf53a 100644
@@ -34,6 +34,7 @@ static void print_explain(FILE *f)
 		"                  [ vlan_filtering VLAN_FILTERING ]\n"
 		"                  [ vlan_protocol VLAN_PROTOCOL ]\n"
 		"                  [ vlan_default_pvid VLAN_DEFAULT_PVID ]\n"
+		"                  [ vlan_state VLAN_STATE ]\n"
 		"                  [ mcast_snooping MULTICAST_SNOOPING ]\n"
 		"                  [ mcast_router MULTICAST_ROUTER ]\n"
 		"                  [ mcast_query_use_ifaddr MCAST_QUERY_USE_IFADDR ]\n"
@@ -157,6 +158,14 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
 
 			addattr16(n, 1024, IFLA_BR_VLAN_DEFAULT_PVID,
 				  default_pvid);
+		} else if (matches(*argv, "vlan_state") == 0) {
+			__u8 vlan_state;
+
+			NEXT_ARG();
+			if (get_u8(&vlan_state, *argv, 0))
+				invarg("invalid vlan_state", *argv);
+			addattr8(n, 1024, IFLA_BR_VLAN_STATS_ENABLED,
+				  vlan_state);
 		} else if (matches(*argv, "mcast_router") == 0) {
 			__u8 mcast_router;
 
@@ -442,6 +451,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 		fprintf(f, "vlan_default_pvid %u ",
 			rta_getattr_u16(tb[IFLA_BR_VLAN_DEFAULT_PVID]));
 
+	if (tb[IFLA_BR_VLAN_STATS_ENABLED])
+		fprintf(f, "vlan_state %u ",
+			rta_getattr_u8(tb[IFLA_BR_VLAN_STATS_ENABLED]));
+
 	if (tb[IFLA_BR_GROUP_FWD_MASK])
 		fprintf(f, "group_fwd_mask %#x ",
 			rta_getattr_u16(tb[IFLA_BR_GROUP_FWD_MASK]));
Signature · 1 line
2.5.5
#7 lore raw

PATCH 4/5 iplink: bridge: add support for IFLA_BR_MCAST_IGMP_VERSION

In reply to Hangbin Liu

This patch implements support for the IFLA_BR_MCAST_IGMP_VERSION attribute in iproute2 so it can change the mcast igmp version.

---
 ip/iplink_bridge.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
ip/iplink_bridge.c +13 -0
index 622bd07..6611a85 100644
@@ -50,6 +50,7 @@ static void print_explain(FILE *f)
 		"                  [ mcast_query_response_interval QUERY_RESPONSE_INTERVAL ]\n"
 		"                  [ mcast_startup_query_interval STARTUP_QUERY_INTERVAL ]\n"
 		"                  [ mcast_state MCAST_STATE ]\n"
+		"                  [ mcast_igmp_version IGMP_VERSION ]\n"
 		"                  [ nf_call_iptables NF_CALL_IPTABLES ]\n"
 		"                  [ nf_call_ip6tables NF_CALL_IP6TABLES ]\n"
 		"                  [ nf_call_arptables NF_CALL_ARPTABLES ]\n"
@@ -308,6 +309,14 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
 				invarg("invalid mcast_state", *argv);
 			addattr8(n, 1024, IFLA_BR_MCAST_STATS_ENABLED,
 				  mcast_state);
+		} else if (matches(*argv, "mcast_igmp_version") == 0) {
+			__u8 igmp_version;
+
+			NEXT_ARG();
+			if (get_u8(&igmp_version, *argv, 0))
+				invarg("invalid mcast_igmp_version", *argv);
+			addattr8(n, 1024, IFLA_BR_MCAST_IGMP_VERSION,
+				  igmp_version);
 		} else if (matches(*argv, "nf_call_iptables") == 0) {
 			__u8 nf_call_ipt;
 
@@ -537,6 +546,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 		fprintf(f, "mcast_state %u ",
 			rta_getattr_u8(tb[IFLA_BR_MCAST_STATS_ENABLED]));
 
+	if (tb[IFLA_BR_MCAST_IGMP_VERSION])
+		fprintf(f, "mcast_igmp_version %u ",
+			rta_getattr_u8(tb[IFLA_BR_MCAST_IGMP_VERSION]));
+
 	if (tb[IFLA_BR_NF_CALL_IPTABLES])
 		fprintf(f, "nf_call_iptables %u ",
 			rta_getattr_u8(tb[IFLA_BR_NF_CALL_IPTABLES]));
Signature · 1 line
2.5.5
#6 lore raw

Re: [PATCH iproute2 net-next 3/5] iplink: bridge: add support for IFLA_BR_MCAST_STATS_ENABLED

In reply to Hangbin Liu
Quoted 5 lines · Hangbin Liu

This patch implements support for the IFLA_BR_MCAST_STATS_ENABLED attribute in iproute2 so it can change the mcast state.

---

It is not state, it is _stats_. Calling it mcast_state is completely wrong, please change the name to something like mcast_stats_enabled which is closer to the sysfs and netlink attribute.

Quoted 42 lines
 ip/iplink_bridge.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
ip/iplink_bridge.c +13 -0
index 8caf53a..622bd07 100644
@@ -49,6 +49,7 @@ static void print_explain(FILE *f)
 		"                  [ mcast_query_interval QUERY_INTERVAL ]\n"
 		"                  [ mcast_query_response_interval QUERY_RESPONSE_INTERVAL ]\n"
 		"                  [ mcast_startup_query_interval STARTUP_QUERY_INTERVAL ]\n"
+		"                  [ mcast_state MCAST_STATE ]\n"
 		"                  [ nf_call_iptables NF_CALL_IPTABLES ]\n"
 		"                  [ nf_call_ip6tables NF_CALL_IP6TABLES ]\n"
 		"                  [ nf_call_arptables NF_CALL_ARPTABLES ]\n"
@@ -299,6 +300,14 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
 
 			addattr64(n, 1024, IFLA_BR_MCAST_STARTUP_QUERY_INTVL,
 				  mcast_startup_query_intvl);
+		} else if (matches(*argv, "mcast_state") == 0) {
+			__u8 mcast_state;
+
+			NEXT_ARG();
+			if (get_u8(&mcast_state, *argv, 0))
+				invarg("invalid mcast_state", *argv);
+			addattr8(n, 1024, IFLA_BR_MCAST_STATS_ENABLED,
+				  mcast_state);
 		} else if (matches(*argv, "nf_call_iptables") == 0) {
 			__u8 nf_call_ipt;
 
@@ -524,6 +533,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 		fprintf(f, "mcast_startup_query_interval %llu ",
 			rta_getattr_u64(tb[IFLA_BR_MCAST_STARTUP_QUERY_INTVL]));
 
+	if (tb[IFLA_BR_MCAST_STATS_ENABLED])
+		fprintf(f, "mcast_state %u ",
+			rta_getattr_u8(tb[IFLA_BR_MCAST_STATS_ENABLED]));
+
 	if (tb[IFLA_BR_NF_CALL_IPTABLES])
 		fprintf(f, "nf_call_iptables %u ",
 			rta_getattr_u8(tb[IFLA_BR_NF_CALL_IPTABLES]));
#4 lore raw

Re: [PATCH iproute2 net-next 2/5] iplink: bridge: add support for IFLA_BR_VLAN_STATS_ENABLED

In reply to Hangbin Liu
Quoted 5 lines · Hangbin Liu

This patch implements support for the IFLA_BR_VLAN_STATS_ENABLED attribute in iproute2 so it can change the vlan state.

---

Again it is not state, it is _stats_. Please change the name to something like vlan_stats_enabled which is closer to the netlink attribute.

Quoted 42 lines
 ip/iplink_bridge.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
ip/iplink_bridge.c +13 -0
index 85e6597..8caf53a 100644
@@ -34,6 +34,7 @@ static void print_explain(FILE *f)
 		"                  [ vlan_filtering VLAN_FILTERING ]\n"
 		"                  [ vlan_protocol VLAN_PROTOCOL ]\n"
 		"                  [ vlan_default_pvid VLAN_DEFAULT_PVID ]\n"
+		"                  [ vlan_state VLAN_STATE ]\n"
 		"                  [ mcast_snooping MULTICAST_SNOOPING ]\n"
 		"                  [ mcast_router MULTICAST_ROUTER ]\n"
 		"                  [ mcast_query_use_ifaddr MCAST_QUERY_USE_IFADDR ]\n"
@@ -157,6 +158,14 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
 
 			addattr16(n, 1024, IFLA_BR_VLAN_DEFAULT_PVID,
 				  default_pvid);
+		} else if (matches(*argv, "vlan_state") == 0) {
+			__u8 vlan_state;
+
+			NEXT_ARG();
+			if (get_u8(&vlan_state, *argv, 0))
+				invarg("invalid vlan_state", *argv);
+			addattr8(n, 1024, IFLA_BR_VLAN_STATS_ENABLED,
+				  vlan_state);
 		} else if (matches(*argv, "mcast_router") == 0) {
 			__u8 mcast_router;
 
@@ -442,6 +451,10 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 		fprintf(f, "vlan_default_pvid %u ",
 			rta_getattr_u16(tb[IFLA_BR_VLAN_DEFAULT_PVID]));
 
+	if (tb[IFLA_BR_VLAN_STATS_ENABLED])
+		fprintf(f, "vlan_state %u ",
+			rta_getattr_u8(tb[IFLA_BR_VLAN_STATS_ENABLED]));
+
 	if (tb[IFLA_BR_GROUP_FWD_MASK])
 		fprintf(f, "group_fwd_mask %#x ",
 			rta_getattr_u16(tb[IFLA_BR_GROUP_FWD_MASK]));
#11 lore raw
In reply to Hangbin Liu
Quoted 9 lines · Hangbin Liu

Add the bridge netlink attributes added to kernel recently.

Hangbin Liu (5):
iplink: bridge: add support for IFLA_BR_FDB_FLUSH
iplink: bridge: add support for IFLA_BR_VLAN_STATS_ENABLED
iplink: bridge: add support for IFLA_BR_MCAST_STATS_ENABLED
iplink: bridge: add support for IFLA_BR_MCAST_IGMP_VERSION
iplink: bridge: add support for IFLA_BR_MCAST_MLD_VERSION

Quoted 3 lines
 ip/iplink_bridge.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 56 insertions(+), 1 deletion(-)

Cool, I also have a version of all of these patches just didn't get around to send them yet. :-) Anyway since you're at it, you should also add support for IFLA_BRPORT_FLUSH, but TBH I don't think the flush attributes should be used via this command, they seem like an action that you do rather than an option that you set. That is the reason I didn't add support for them awhile back when I added the others. But I don't have a strong feeling about doing it via ip link set or not, so if the others are fine, I'm good too.

Cheers,
Nik

Reviewed-by on v1 4/5
#8 lore raw

Re: [PATCH iproute2 net-next 4/5] iplink: bridge: add support for IFLA_BR_MCAST_IGMP_VERSION

In reply to Hangbin Liu
Quoted 8 lines · Hangbin Liu

This patch implements support for the IFLA_BR_MCAST_IGMP_VERSION attribute in iproute2 so it can change the mcast igmp version.

---
 ip/iplink_bridge.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH iproute2 net-next 1/5] iplink: bridge: add support for IFLA_BR_FDB_FLUSH

In reply to Hangbin Liu
Quoted 8 lines · Hangbin Liu

This patch implements support for the IFLA_BR_FDB_FLUSH attribute in iproute2 so it can flush bridge fdb dynamic entries.

---
 ip/iplink_bridge.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Reviewed-by on v1 5/5
#10 lore raw

Re: [PATCH iproute2 net-next 5/5] iplink: bridge: add support for IFLA_BR_MCAST_MLD_VERSION

In reply to Hangbin Liu
Quoted 8 lines · Hangbin Liu

This patch implements support for the IFLA_BR_MCAST_MLD_VERSION attribute in iproute2 so it can change the mcast mld version.

---
 ip/iplink_bridge.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)