Skip to content

Commit

Permalink
bridge: Extend br_fill_ifinfo to return MPR status
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Horatiu Vultur authored and David S. Miller committed Jul 2, 2020
1 parent df42ef2 commit 36a8e8e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/uapi/linux/rtnetlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ enum {
#define RTEXT_FILTER_BRVLAN (1 << 1)
#define RTEXT_FILTER_BRVLAN_COMPRESSED (1 << 2)
#define RTEXT_FILTER_SKIP_STATS (1 << 3)
#define RTEXT_FILTER_MRP (1 << 4)

/* End of information exported to user level */

Expand Down
25 changes: 24 additions & 1 deletion net/bridge/br_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,28 @@ static int br_fill_ifinfo(struct sk_buff *skb,
rcu_read_unlock();
if (err)
goto nla_put_failure;

nla_nest_end(skb, af);
}

if (filter_mask & RTEXT_FILTER_MRP) {
struct nlattr *af;
int err;

if (!br_mrp_enabled(br) || port)
goto done;

af = nla_nest_start_noflag(skb, IFLA_AF_SPEC);
if (!af)
goto nla_put_failure;

rcu_read_lock();
err = br_mrp_fill_info(skb, br);
rcu_read_unlock();

if (err)
goto nla_put_failure;

nla_nest_end(skb, af);
}

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

if (!port && !(filter_mask & RTEXT_FILTER_BRVLAN) &&
!(filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED))
!(filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED) &&
!(filter_mask & RTEXT_FILTER_MRP))
return 0;

return br_fill_ifinfo(skb, port, pid, seq, RTM_NEWLINK, nlflags,
Expand Down

0 comments on commit 36a8e8e

Please sign in to comment.