[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f11ffe19-ed48-86c2-6726-9af9b2954a7e@gmail.com>
Date: Wed, 21 Jun 2017 23:07:07 -0400
From: David Ahern <dsahern@...il.com>
To: Cong Wang <xiyou.wangcong@...il.com>, netdev@...r.kernel.org
Cc: Andrey Konovalov <andreyknvl@...gle.com>,
Daniel Lezcano <dlezcano@...ibm.com>
Subject: Re: [Patch net] ipv6: avoid unregistering inet6_dev for loopback
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 <dsahern@...il.com>
Powered by blists - more mailing lists