1 From f8b65172fe4f8e6aab8946ba004a7176c0249e1d Mon Sep 17 00:00:00 2001
2 From: Alexandre Derumier <aderumier@odiso.com>
3 Date: Wed, 16 Sep 2015 08:43:56 +0200
4 Subject: [PATCH] fix rtnl_bridge_getlink
6 Looks like this was due to 85fdb956726ff2a ("switchdev: cut over to new
7 switchdev_port_bridge_getlink").
8 When CONFIG_SWITCHDEV is off, nodes that use switchdev api for
9 ndo_bridge_getlink (example, bonds, teams, rocker) can return
10 -EOPNOTSUPP. The problem went away on my box with the following patch. I
11 will submit an official patch in a bit.
13 Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
15 net/core/rtnetlink.c | 27 +++++++++++++++++----------
16 1 file changed, 17 insertions(+), 10 deletions(-)
18 diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
19 index dc004b1..9e8cffc 100644
20 --- a/net/core/rtnetlink.c
21 +++ b/net/core/rtnetlink.c
22 @@ -3021,6 +3021,7 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb)
23 u32 portid = NETLINK_CB(cb->skb).portid;
24 u32 seq = cb->nlh->nlmsg_seq;
28 if (nlmsg_len(cb->nlh) > sizeof(struct ifinfomsg)) {
29 struct nlattr *extfilt;
30 @@ -3041,20 +3042,26 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb)
31 struct net_device *br_dev = netdev_master_upper_dev_get(dev);
33 if (br_dev && br_dev->netdev_ops->ndo_bridge_getlink) {
34 - if (idx >= cb->args[0] &&
35 - br_dev->netdev_ops->ndo_bridge_getlink(
36 - skb, portid, seq, dev, filter_mask,
39 + if (idx >= cb->args[0]) {
40 + err = br_dev->netdev_ops->ndo_bridge_getlink(
41 + skb, portid, seq, dev,
42 + filter_mask, NLM_F_MULTI);
43 + if ( err < 0 && err != -EOPNOTSUPP)
50 if (ops->ndo_bridge_getlink) {
51 - if (idx >= cb->args[0] &&
52 - ops->ndo_bridge_getlink(skb, portid, seq, dev,
56 + if (idx >= cb->args[0]) {
57 + err = ops->ndo_bridge_getlink(skb, portid,
61 + if ( err < 0 && err != -EOPNOTSUPP)