Commit 1f372c7b authored by Mike Manning's avatar Mike Manning Committed by David S. Miller

net: ipv6: send NS for DAD when link operationally up

The NS for DAD are sent on admin up as long as a valid qdisc is found.
A race condition exists by which these packets will not egress the
interface if the operational state of the lower device is not yet up.
The solution is to delay DAD until the link is operationally up
according to RFC2863. Rather than only doing this, follow the existing
code checks by deferring IPv6 device initialization altogether. The fix
allows DAD on devices like tunnels that are controlled by userspace
control plane. The fix has no impact on regular deployments, but means
that there is no IPv6 connectivity until the port has been opened in
the case of port-based network access control, which should be
desirable.
Signed-off-by: default avatarMike Manning <mmanning@brocade.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fa8fefaa
...@@ -303,10 +303,10 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = { ...@@ -303,10 +303,10 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
.disable_policy = 0, .disable_policy = 0,
}; };
/* Check if a valid qdisc is available */ /* Check if link is ready: is it up and is a valid qdisc available */
static inline bool addrconf_qdisc_ok(const struct net_device *dev) static inline bool addrconf_link_ready(const struct net_device *dev)
{ {
return !qdisc_tx_is_noop(dev); return netif_oper_up(dev) && !qdisc_tx_is_noop(dev);
} }
static void addrconf_del_rs_timer(struct inet6_dev *idev) static void addrconf_del_rs_timer(struct inet6_dev *idev)
...@@ -451,7 +451,7 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev) ...@@ -451,7 +451,7 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev)
ndev->token = in6addr_any; ndev->token = in6addr_any;
if (netif_running(dev) && addrconf_qdisc_ok(dev)) if (netif_running(dev) && addrconf_link_ready(dev))
ndev->if_flags |= IF_READY; ndev->if_flags |= IF_READY;
ipv6_mc_init_dev(ndev); ipv6_mc_init_dev(ndev);
...@@ -3403,7 +3403,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, ...@@ -3403,7 +3403,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
/* restore routes for permanent addresses */ /* restore routes for permanent addresses */
addrconf_permanent_addr(dev); addrconf_permanent_addr(dev);
if (!addrconf_qdisc_ok(dev)) { if (!addrconf_link_ready(dev)) {
/* device is not ready yet. */ /* device is not ready yet. */
pr_info("ADDRCONF(NETDEV_UP): %s: link is not ready\n", pr_info("ADDRCONF(NETDEV_UP): %s: link is not ready\n",
dev->name); dev->name);
...@@ -3418,7 +3418,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, ...@@ -3418,7 +3418,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
run_pending = 1; run_pending = 1;
} }
} else if (event == NETDEV_CHANGE) { } else if (event == NETDEV_CHANGE) {
if (!addrconf_qdisc_ok(dev)) { if (!addrconf_link_ready(dev)) {
/* device is still not ready. */ /* device is still not ready. */
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment