[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <9599bc5738a16580aa5b87a6586110953918d622.1600770261.git.sd@queasysnail.net>
Date: Thu, 1 Oct 2020 09:59:36 +0200
From: Sabrina Dubroca <sd@...asysnail.net>
To: netdev@...r.kernel.org
Cc: Sabrina Dubroca <sd@...asysnail.net>,
Marek Lindner <mareklindner@...mailbox.ch>,
Simon Wunderlich <sw@...onwunderlich.de>,
Antonio Quartulli <a@...table.cc>,
Sven Eckelmann <sven@...fation.org>,
b.a.t.m.a.n@...ts.open-mesh.org
Subject: [PATCH net 12/12] batman-adv: fix detection of lower link in batadv_get_real_netdevice
Currently, batadv_get_real_netdevice can return different results in
this situation:
ip netns add main
ip netns add peer
ip -net main link add dummy1 type dummy
ip -net main link add link dummy1 netns peer type macsec # same ifindex as dummy1
ip -net main link add link dummy1 netns peer type macsec port 2
Let's use the presence of a ndo_get_iflink operation, rather than the
value it returns, to detect a device without a link.
Fixes: 5ed4a460a1d3 ("batman-adv: additional checks for virtual interfaces on top of WiFi")
Signed-off-by: Sabrina Dubroca <sd@...asysnail.net>
---
net/batman-adv/hard-interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 0d87c5d56844..8f7d2dd37321 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -223,7 +223,7 @@ static struct net_device *batadv_get_real_netdevice(struct net_device *netdev)
if (!netdev)
return NULL;
- if (netdev->ifindex == dev_get_iflink(netdev)) {
+ if (!(netdev->netdev_ops && netdev->netdev_ops->ndo_get_iflink)) {
dev_hold(netdev);
return netdev;
}
--
2.28.0
Powered by blists - more mailing lists