netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Cong Wang <xiyou.wangcong@gmail.com>, netdev@vger.kernel.org
Cc: Andrey Konovalov <andreyknvl@google.com>,
	Daniel Lezcano <dlezcano@fr.ibm.com>
Subject: Re: [Patch net] ipv6: avoid unregistering inet6_dev for loopback
Date: Wed, 21 Jun 2017 23:07:07 -0400	[thread overview]
Message-ID: <f11ffe19-ed48-86c2-6726-9af9b2954a7e@gmail.com> (raw)
In-Reply-To: <1498080898-17338-1-git-send-email-xiyou.wangcong@gmail.com>

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@gmail.com>

  reply	other threads:[~2017-06-22  3:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21 21:34 [Patch net] ipv6: avoid unregistering inet6_dev for loopback Cong Wang
2017-06-22  3:07 ` David Ahern [this message]
2017-06-22 10:10 ` Andrey Konovalov
2017-06-22 17:22 ` David Miller
2017-06-22 17:24 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f11ffe19-ed48-86c2-6726-9af9b2954a7e@gmail.com \
    --to=dsahern@gmail.com \
    --cc=andreyknvl@google.com \
    --cc=dlezcano@fr.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).