From: Sabrina Dubroca <sd@queasysnail.net>
To: netdev@vger.kernel.org
Cc: Sabrina Dubroca <sd@queasysnail.net>,
Marek Lindner <mareklindner@neomailbox.ch>,
Simon Wunderlich <sw@simonwunderlich.de>,
Antonio Quartulli <a@unstable.cc>,
Sven Eckelmann <sven@narfation.org>,
b.a.t.m.a.n@lists.open-mesh.org
Subject: [PATCH net 12/12] batman-adv: fix detection of lower link in batadv_get_real_netdevice
Date: Thu, 1 Oct 2020 09:59:36 +0200 [thread overview]
Message-ID: <9599bc5738a16580aa5b87a6586110953918d622.1600770261.git.sd@queasysnail.net> (raw)
In-Reply-To: <cover.1600770261.git.sd@queasysnail.net>
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@queasysnail.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
next prev parent reply other threads:[~2020-10-01 7:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-01 7:59 [PATCH net 00/12] net: iflink and link-netnsid fixes Sabrina Dubroca
2020-10-01 7:59 ` [PATCH net 11/12] batman-adv: fix iflink detection in batadv_is_on_batman_iface Sabrina Dubroca
2022-05-14 10:21 ` Sven Eckelmann
2020-10-01 7:59 ` Sabrina Dubroca [this message]
2020-10-01 21:25 ` [PATCH net 00/12] net: iflink and link-netnsid fixes Stephen Hemminger
2020-10-02 9:07 ` Sabrina Dubroca
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9599bc5738a16580aa5b87a6586110953918d622.1600770261.git.sd@queasysnail.net \
--to=sd@queasysnail.net \
--cc=a@unstable.cc \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=mareklindner@neomailbox.ch \
--cc=netdev@vger.kernel.org \
--cc=sven@narfation.org \
--cc=sw@simonwunderlich.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).