Thread (4 messages) 4 messages, 3 authors, 2007-03-28

Re: [IPV6]: Do not set IF_READY if device is down

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2007-03-27 21:30:47
Subsystem: networking [general], networking [ipv4/ipv6], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Ahern, Ido Schimmel, Linus Torvalds

On Tue, Mar 27, 2007 at 02:57:18PM +0100, David Woodhouse wrote:
quoted
    [IPV6]: Do not set IF_READY if device is down
    
    Now that we add the IPv6 device at registration time we don't need
    to set IF_READY in ipv6_add_dev anymore because we will always get
    a NETDEV_UP event later on should the device ever become ready.
    
    Signed-off-by: Herbert Xu [off-list ref]
    Signed-off-by: David S. Miller [off-list ref]
This commit seems to have broken NetworkManager, which removes the
link-local IPv6 address from each wireless interface while it's only
intending to use it for scanning, then adds it back when it actually
wants to _use_ the interface in question.
Sorry, that patch is indeed broken.  We do need to set IF_READY in
the case where all addresses were deleted (including the link-local)
and then recreated.  The IPv6 device will be destroyed and recreated
too in that case.

[IPV6]: Set IF_READY if the device is up and has carrier

We still need to set the IF_READY flag in ipv6_add_dev for the case
where all addresses (including the link-local) are deleted and then
recreated.  In that case the IPv6 device too will be destroyed and
then recreated.

In order to prevent the original problem, we simply ensure that
the device is up before setting IF_READY.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 1b61699..7552663 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -342,6 +342,9 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
 	}
 #endif
 
+	if (netif_running(dev) && netif_carrier_ok(dev))
+		ndev->if_flags |= IF_READY;
+
 	ipv6_mc_init_dev(ndev);
 	ndev->tstamp = jiffies;
 #ifdef CONFIG_SYSCTL
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help