public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2] rtnetlink: catch -EOPNOTSUPP errors from ndo_bridge_getlink
@ 2015-09-15 21:44 Roopa Prabhu
  2015-09-15 22:04 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Roopa Prabhu @ 2015-09-15 21:44 UTC (permalink / raw)
  To: davem; +Cc: aderumier, sfeldma, jiri, netdev

From: Roopa Prabhu <roopa@cumulusnetworks.com>

problem reported:
	kernel 4.1.3
	------------
	# bridge vlan
	port	vlan ids
	eth0	 1 PVID Egress Untagged
	 	90
	 	91
	 	92
	 	93
	 	94
	 	95
	 	96
	 	97
	 	98
	 	99
	 	100

	vmbr0	 1 PVID Egress Untagged
	 	94

	kernel 4.2
	-----------
	# bridge vlan
	port	vlan ids

ndo_bridge_getlink can return -EOPNOTSUPP when an interfaces
ndo_bridge_getlink op is set to switchdev_port_bridge_getlink
and CONFIG_SWITCHDEV is not defined. This today can happen to
bond, rocker and team devices. This patch adds -EOPNOTSUPP
checks after calls to ndo_bridge_getlink.

Fixes: 85fdb956726ff2a ("switchdev: cut over to new switchdev_port_bridge_getlink")
Reported-by: Alexandre DERUMIER <aderumier@odiso.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
v2: fix checkpatch errors

 net/core/rtnetlink.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index a466821..0ec4840 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -3047,6 +3047,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;
@@ -3067,20 +3068,25 @@ 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++;
 		}
 	}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net v2] rtnetlink: catch -EOPNOTSUPP errors from ndo_bridge_getlink
  2015-09-15 21:44 [PATCH net v2] rtnetlink: catch -EOPNOTSUPP errors from ndo_bridge_getlink Roopa Prabhu
@ 2015-09-15 22:04 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-09-15 22:04 UTC (permalink / raw)
  To: roopa; +Cc: aderumier, sfeldma, jiri, netdev

From: Roopa Prabhu <roopa@cumulusnetworks.com>
Date: Tue, 15 Sep 2015 14:44:29 -0700

> From: Roopa Prabhu <roopa@cumulusnetworks.com>
 ...
> ndo_bridge_getlink can return -EOPNOTSUPP when an interfaces
> ndo_bridge_getlink op is set to switchdev_port_bridge_getlink
> and CONFIG_SWITCHDEV is not defined. This today can happen to
> bond, rocker and team devices. This patch adds -EOPNOTSUPP
> checks after calls to ndo_bridge_getlink.
> 
> Fixes: 85fdb956726ff2a ("switchdev: cut over to new switchdev_port_bridge_getlink")
> Reported-by: Alexandre DERUMIER <aderumier@odiso.com>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> ---
> v2: fix checkpatch errors

Applied, thanks for fixing this Roopa.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-15 22:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-15 21:44 [PATCH net v2] rtnetlink: catch -EOPNOTSUPP errors from ndo_bridge_getlink Roopa Prabhu
2015-09-15 22:04 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox