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