[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220214014446.22097-3-bpoirier@nvidia.com>
Date: Mon, 14 Feb 2022 10:44:46 +0900
From: Benjamin Poirier <bpoirier@...dia.com>
To: Stephen Hemminger <stephen@...workplumber.org>
CC: <netdev@...r.kernel.org>
Subject: [PATCH iproute2 2/2] bridge: Remove vlan listing from `bridge link`
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")
Signed-off-by: Benjamin Poirier <bpoirier@...dia.com>
---
bridge/link.c | 22 +++-------------------
1 file changed, 3 insertions(+), 19 deletions(-)
diff --git a/bridge/link.c b/bridge/link.c
index b6292984..bc7837a9 100644
--- a/bridge/link.c
+++ b/bridge/link.c
@@ -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);
--
2.34.1
Powered by blists - more mailing lists