History

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.

Mike Manning committed 9 years ago

Commit 1f372c71 parent fa8fefa1 file · +6 −6Browse files

Unified · Split

net/ipv6/addrconf.c+6−6
@@ -303,10 +303,10 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = { · 302 unmodified lines
303 .disable_policy = 0,303 .disable_policy = 0,
304};304};
305 305
306/* Check if a valid qdisc is available */306/* Check if link is ready: is it up and is a valid qdisc available */
307static inline bool addrconf_qdisc_ok(const struct net_device *dev)307static inline bool addrconf_link_ready(const struct net_device *dev)
308{308{
309 return !qdisc_tx_is_noop(dev);309 return netif_oper_up(dev) && !qdisc_tx_is_noop(dev);
310}310}
311 311
312static void addrconf_del_rs_timer(struct inet6_dev *idev)312static void addrconf_del_rs_timer(struct inet6_dev *idev)
@@ -451,7 +451,7 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev) · 138 unmodified lines
451 451
452 ndev->token = in6addr_any;452 ndev->token = in6addr_any;
453 453
454 if (netif_running(dev) && addrconf_qdisc_ok(dev))454 if (netif_running(dev) && addrconf_link_ready(dev))
455 ndev->if_flags |= IF_READY;455 ndev->if_flags |= IF_READY;
456 456
457 ipv6_mc_init_dev(ndev);457 ipv6_mc_init_dev(ndev);
@@ -3403,7 +3403,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, · 2945 unmodified lines
3403 /* restore routes for permanent addresses */3403 /* restore routes for permanent addresses */
3404 addrconf_permanent_addr(dev);3404 addrconf_permanent_addr(dev);
3405 3405
3406 if (!addrconf_qdisc_ok(dev)) {3406 if (!addrconf_link_ready(dev)) {
3407 /* device is not ready yet. */3407 /* device is not ready yet. */
3408 pr_info("ADDRCONF(NETDEV_UP): %s: link is not ready\n",3408 pr_info("ADDRCONF(NETDEV_UP): %s: link is not ready\n",
3409 dev->name);3409 dev->name);
@@ -3418,7 +3418,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, · 8 unmodified lines
3418 run_pending = 1;3418 run_pending = 1;
3419 }3419 }
3420 } else if (event == NETDEV_CHANGE) {3420 } else if (event == NETDEV_CHANGE) {
3421 if (!addrconf_qdisc_ok(dev)) {3421 if (!addrconf_link_ready(dev)) {
3422 /* device is still not ready. */3422 /* device is still not ready. */
3423 break;3423 break;
3424 }3424 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t