]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
bridge: Remove vlan listing from `bridge link`
authorBenjamin Poirier <bpoirier@nvidia.com>
Mon, 14 Feb 2022 01:44:46 +0000 (10:44 +0900)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 16 Feb 2022 20:16:43 +0000 (12:16 -0800)
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@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
bridge/link.c

index b6292984b6b8bdfd0ec250db5f2e6ab0855b24ac..bc7837a9474ca25f787d64559b8e82af70001754 100644 (file)
@@ -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);