lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <879af1e3232451feee4a306c1e757bef188b0ee4.1600770261.git.sd@queasysnail.net>
Date:   Thu,  1 Oct 2020 09:59:33 +0200
From:   Sabrina Dubroca <sd@...asysnail.net>
To:     netdev@...r.kernel.org
Cc:     Sabrina Dubroca <sd@...asysnail.net>
Subject: [PATCH net 09/12] net: link_watch: fix operstate when the link has the same index as the device

When we create a macvlan device on top of a bond, the macvlan device
should always start with IF_OPER_LOWERLAYERDOWN if the bond is
down. Currently, this doesn't happen if the macvlan device gets the
same ifindex as the bond, which can happen because different
namespaces assign the ifindex independently:

    ip netns add main
    ip netns add peer
    ip -net main link add type bond # idx 9
    ip -net main link add link bond0 netns peer type macvlan # idx 10
    ip -net main link add link bond0 type macvlan # idx 9

    ip -net main link show type macvlan # M-DOWN since bond0 is DOWN
      10: macvlan0@...d0: <BROADCAST,MULTICAST,M-DOWN> ...

    ip -net peer link show type macvlan # should also be M-DOWN
       9: macvlan0@if9: <BROADCAST,MULTICAST> ...

Fixes: d8a5ec672768 ("[NET]: netlink support for moving devices between network namespaces.")
Signed-off-by: Sabrina Dubroca <sd@...asysnail.net>
---
 net/core/link_watch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index 75431ca9300f..6932ad51aa4a 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -38,7 +38,7 @@ static unsigned char default_operstate(const struct net_device *dev)
 		return IF_OPER_TESTING;
 
 	if (!netif_carrier_ok(dev))
-		return (dev->ifindex != dev_get_iflink(dev) ?
+		return (dev->netdev_ops && dev->netdev_ops->ndo_get_iflink ?
 			IF_OPER_LOWERLAYERDOWN : IF_OPER_DOWN);
 
 	if (netif_dormant(dev))
-- 
2.28.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ