On 6/21/17 5:34 PM, Cong Wang wrote:
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 686c923..1d2dbac 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -3369,6 +3369,7 @@ static int addrconf_notify(struct notifier_block *this, 
> unsigned long event,
>       struct net_device *dev = netdev_notifier_info_to_dev(ptr);
>       struct netdev_notifier_changeupper_info *info;
>       struct inet6_dev *idev = __in6_dev_get(dev);
> +     struct net *net = dev_net(dev);

Given the number of NETDEV events and the fact that only 2 need net,
perhaps the dev_net(dev) should be inline ...

>       int run_pending = 0;
>       int err;
>  
> @@ -3384,7 +3385,7 @@ static int addrconf_notify(struct notifier_block *this, 
> unsigned long event,
>       case NETDEV_CHANGEMTU:
>               /* if MTU under IPV6_MIN_MTU stop IPv6 on this interface. */
>               if (dev->mtu < IPV6_MIN_MTU) {
> -                     addrconf_ifdown(dev, 1);
> +                     addrconf_ifdown(dev, dev != net->loopback_dev);

so:
                        addrconf_ifdown(dev, dev != dev_net(dev)->loopback_dev);


>                       break;
>               }
>  
> @@ -3500,7 +3501,7 @@ static int addrconf_notify(struct notifier_block *this, 
> unsigned long event,
>                        * IPV6_MIN_MTU stop IPv6 on this interface.
>                        */
>                       if (dev->mtu < IPV6_MIN_MTU)
> -                             addrconf_ifdown(dev, 1);
> +                             addrconf_ifdown(dev, dev != net->loopback_dev);
>               }
>               break;
>  
> 

The overall idea of not destroying idev for loopback on a failure to set
MTU seems correct to me.

Acked-by: David Ahern <dsah...@gmail.com>

Reply via email to