Skip to content

Commit

Permalink
ipv6: recreate ipv6 link-local addresses when increasing MTU over IPV…
Browse files Browse the repository at this point in the history
…6_MIN_MTU

This change makes it so that we reinitialize the interface if the MTU is
increased back above IPV6_MIN_MTU and the interface is up.

Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alexander Duyck authored and David S. Miller committed Oct 30, 2015
1 parent ee62593 commit b7b0b1d
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3147,6 +3147,32 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
}
break;

case NETDEV_CHANGEMTU:
/* if MTU under IPV6_MIN_MTU stop IPv6 on this interface. */
if (dev->mtu < IPV6_MIN_MTU) {
addrconf_ifdown(dev, 1);
break;
}

if (idev) {
rt6_mtu_change(dev, dev->mtu);
idev->cnf.mtu6 = dev->mtu;
break;
}

/* allocate new idev */
idev = ipv6_add_dev(dev);
if (IS_ERR(idev))
break;

/* device is still not ready */
if (!(idev->if_flags & IF_READY))
break;

run_pending = 1;

/* fall through */

case NETDEV_UP:
case NETDEV_CHANGE:
if (dev->flags & IFF_SLAVE)
Expand All @@ -3170,7 +3196,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
idev->if_flags |= IF_READY;
run_pending = 1;
}
} else {
} else if (event == NETDEV_CHANGE) {
if (!addrconf_qdisc_ok(dev)) {
/* device is still not ready. */
break;
Expand Down Expand Up @@ -3235,24 +3261,6 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
}
break;

case NETDEV_CHANGEMTU:
if (idev && dev->mtu >= IPV6_MIN_MTU) {
rt6_mtu_change(dev, dev->mtu);
idev->cnf.mtu6 = dev->mtu;
break;
}

if (!idev && dev->mtu >= IPV6_MIN_MTU) {
idev = ipv6_add_dev(dev);
if (!IS_ERR(idev))
break;
}

/*
* if MTU under IPV6_MIN_MTU.
* Stop IPv6 on this interface.
*/

case NETDEV_DOWN:
case NETDEV_UNREGISTER:
/*
Expand Down

0 comments on commit b7b0b1d

Please sign in to comment.