Skip to contentSkip to conversation

bridge vlan/link fixes

PATCH New Benjamin Poirier 1 participant 3 messages Feb 14, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover bridge vlan/link fixes

Benjamin Poirier (2):
bridge: Fix error string typo
bridge: Remove vlan listing from bridge link

 bridge/link.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 bridge: Fix error string typo

Fixes fab9a18a2e52 ("bridge: request vlans along with link information")
---
 bridge/link.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
bridge/link.c +2 -2
index 205a2fe7..b6292984 100644
@@ -543,12 +543,12 @@ static int brlink_show(int argc, char **argv)
 					     (compress_vlans ?
 					      RTEXT_FILTER_BRVLAN_COMPRESSED :
 					      RTEXT_FILTER_BRVLAN)) < 0) {
-			perror("Cannon send dump request");
+			perror("Cannot send dump request");
 			exit(1);
 		}
 	} else {
 		if (rtnl_linkdump_req(&rth, PF_BRIDGE) < 0) {
-			perror("Cannon send dump request");
+			perror("Cannot send dump request");
 			exit(1);
 		}
 	}
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/2 bridge: Remove vlan listing from `bridge link`

In reply to Benjamin Poirier

vlan listing from bridge link -d was broken by commit f32e4977dcb0 ("bridge:
add json support for link command"). print_vlan_info() expects to be passed a IFLA_AF_SPEC attribute (as is done in print_vlan()) but that commit changed the call in link.c to pass a IFLA_BRIDGE_VLAN_INFO attribute instead. As a result, a struct bridge_vlan_info is mistakenly parsed as a struct rtattr and print_vlan_info() usually exits early in this callpath.

The output style of print_vlan_info() (one line per vlan) is different from the output style of bridge link (multiple attributes per line). The json output is also unsuitable for bridge link. Since vlan listing is available from bridge vlan, remove it from bridge link instead of trying to change print_vlan_info().

Note that previously, bridge master devices would be included in the output when specifying '-d' (and only in that case) but they are no longer included because there is no detailed information to show for master devices if we are not printing a vlan listing:

$ bridge link
4: vxlan0: <BROADCAST,MULTICAST> mtu 1500 master br0 state disabled priority 32 cost 100
$ bridge -d link
3: br0: <BROADCAST,MULTICAST> mtu 1500 master br0
4: vxlan0: <BROADCAST,MULTICAST> mtu 1500 master br0 state disabled priority 32 cost 100
    hairpin off guard off root_block off fastleave off learning on flood on mcast_flood on mcast_to_unicast off neigh_suppress off vlan_tunnel on isolated off
$ ./bridge/bridge -d link
4: vxlan0: <BROADCAST,MULTICAST> mtu 1500 master br0 state disabled priority 32 cost 100
    hairpin off guard off root_block off fastleave off learning on flood on mcast_flood on mcast_to_unicast off neigh_suppress off vlan_tunnel on isolated off
Fixes f32e4977dcb0 ("bridge: add json support for link command")
---
 bridge/link.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)
bridge/link.c +3 -19
index b6292984..bc7837a9 100644
@@ -192,12 +192,6 @@ static void print_af_spec(struct rtattr *attr, int ifindex)
 
 	if (aftb[IFLA_BRIDGE_MODE])
 		print_hwmode(rta_getattr_u16(aftb[IFLA_BRIDGE_MODE]));
-
-	if (!show_details)
-		return;
-
-	if (aftb[IFLA_BRIDGE_VLAN_INFO])
-		print_vlan_info(aftb[IFLA_BRIDGE_VLAN_INFO], ifindex);
 }
 
 int print_linkinfo(struct nlmsghdr *n, void *arg)
@@ -538,19 +532,9 @@ static int brlink_show(int argc, char **argv)
 			return nodev(filter_dev);
 	}
 
-	if (show_details) {
-		if (rtnl_linkdump_req_filter(&rth, PF_BRIDGE,
-					     (compress_vlans ?
-					      RTEXT_FILTER_BRVLAN_COMPRESSED :
-					      RTEXT_FILTER_BRVLAN)) < 0) {
-			perror("Cannot send dump request");
-			exit(1);
-		}
-	} else {
-		if (rtnl_linkdump_req(&rth, PF_BRIDGE) < 0) {
-			perror("Cannot send dump request");
-			exit(1);
-		}
+	if (rtnl_linkdump_req(&rth, PF_BRIDGE) < 0) {
+		perror("Cannot send dump request");
+		exit(1);
 	}
 
 	new_json_obj(json);
Signature · 1 line
2.34.1