Skip to content

Commit 36a8e8e

Browse files
HoratiuVulturdavem330
authored andcommitted
bridge: Extend br_fill_ifinfo to return MPR status
This patch extends the function br_fill_ifinfo to return also the MRP status for each instance on a bridge. It also adds a new filter RTEXT_FILTER_MRP to return the MRP status only when this is set, not to interfer with the vlans. The MRP status is return only on the bridge interfaces. Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent df42ef2 commit 36a8e8e

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

include/uapi/linux/rtnetlink.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ enum {
778778
#define RTEXT_FILTER_BRVLAN (1 << 1)
779779
#define RTEXT_FILTER_BRVLAN_COMPRESSED (1 << 2)
780780
#define RTEXT_FILTER_SKIP_STATS (1 << 3)
781+
#define RTEXT_FILTER_MRP (1 << 4)
781782

782783
/* End of information exported to user level */
783784

net/bridge/br_netlink.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,28 @@ static int br_fill_ifinfo(struct sk_buff *skb,
453453
rcu_read_unlock();
454454
if (err)
455455
goto nla_put_failure;
456+
457+
nla_nest_end(skb, af);
458+
}
459+
460+
if (filter_mask & RTEXT_FILTER_MRP) {
461+
struct nlattr *af;
462+
int err;
463+
464+
if (!br_mrp_enabled(br) || port)
465+
goto done;
466+
467+
af = nla_nest_start_noflag(skb, IFLA_AF_SPEC);
468+
if (!af)
469+
goto nla_put_failure;
470+
471+
rcu_read_lock();
472+
err = br_mrp_fill_info(skb, br);
473+
rcu_read_unlock();
474+
475+
if (err)
476+
goto nla_put_failure;
477+
456478
nla_nest_end(skb, af);
457479
}
458480

@@ -516,7 +538,8 @@ int br_getlink(struct sk_buff *skb, u32 pid, u32 seq,
516538
struct net_bridge_port *port = br_port_get_rtnl(dev);
517539

518540
if (!port && !(filter_mask & RTEXT_FILTER_BRVLAN) &&
519-
!(filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED))
541+
!(filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED) &&
542+
!(filter_mask & RTEXT_FILTER_MRP))
520543
return 0;
521544

522545
return br_fill_ifinfo(skb, port, pid, seq, RTM_NEWLINK, nlflags,

0 commit comments

Comments
 (0)