public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: chenweilong <chenweilong@huawei•com>
To: David Miller <davem@davemloft•net>, <gaofeng@cn•fujitsu.com>,
	<kumaran.4353@gmail•com>, <netdev@vger•kernel.org>,
	Hannes Frederic Sowa <hannes@stressinduktion•org>
Subject: Re: [PATCH] ipv6: don't call addrconf_dst_alloc again when enable lo
Date: Thu, 2 Jan 2014 15:58:22 +0800	[thread overview]
Message-ID: <52C51C1E.9040603@huawei.com> (raw)
In-Reply-To: <20140102065429.GB22494@order.stressinduktion.org>

On 2014/1/2 14:54, Hannes Frederic Sowa wrote:
> On Thu, Jan 02, 2014 at 01:48:46PM +0800, chenweilong wrote:
>> On 2013/12/31 11:57, Hannes Frederic Sowa wrote:
>>> On Wed, Jun 19, 2013 at 11:05:32PM -0700, David Miller wrote:
>>>> From: Gao feng <gaofeng@cn•fujitsu.com>
>>>> Date: Sun, 16 Jun 2013 11:14:30 +0800
>>>>
>>>>> If we disable all of the net interfaces, and enable
>>>>> un-lo interface before lo interface, we already allocated
>>>>> the addrconf dst in ipv6_add_addr. So we shouldn't allocate
>>>>> it again when we enable lo interface.
>>>>>
>>>>> Otherwise the message below will be triggered.
>>>>> unregister_netdevice: waiting for sit1 to become free. Usage count = 1
>>>>>
>>>>> This problem is introduced by commit 25fb6ca4ed9cad72f14f61629b68dc03c0d9713f
>>>>> "net IPv6 : Fix broken IPv6 routing table after loopback down-up"
>>>>>
>>>>> Signed-off-by: Gao feng <gaofeng@cn•fujitsu.com>
>>>>
>>>> This is the second such regression added by that commit :-/
>>>>
>>>> Applied and queue up for -stable, thanks.
>>>
>>> Hmm, and this change also has a regression and breaks the original fix. :/
>>>
>>> https://bugzilla.kernel.org/show_bug.cgi?id=67951
>>>
>>> I tried to track it down but it seems pretty complicated. Maybe we have to
>>> special-case the take-down of the loopback device.
>>>
>>>
>>>
>>
>> When I did the tests,If 'ifconfig lo down',all IPv6 connection broken,
>> but IPv4 connection were still OK.
>>
>> Is it designed like that or a bug?
> 
> This seems to solve the loopback up/down problem, but there are still
> some issues with up/down of interfaces and routing table interactions.
> 
> We enable routes over interfaces when interface is actually down and
> kick manually specified on-link routes when we actually should try to
> keep them and just disable them.
> 
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 6c16345..61d752a 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -2629,8 +2629,10 @@ static void init_loopback(struct net_device *dev)
>  			if (sp_ifa->flags & (IFA_F_DADFAILED | IFA_F_TENTATIVE))
>  				continue;
>  
> -			if (sp_ifa->rt)
> +			if (sp_ifa->rt) {
> +				ip6_ins_rt(sp_ifa->rt);
>  				continue;
> +			}
>  
>  			sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, false);
>  
> 
> .
> 
I test the patch,it has the problem Gao feng reported.

How about this:

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d5fa5b8..5e2db6e 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2609,10 +2609,13 @@ static void init_loopback(struct net_device *dev)

                        if (sp_ifa->flags & (IFA_F_DADFAILED | IFA_F_TENTATIVE))
                                continue;

-                       if (sp_ifa->rt)
-                               continue;
+                       if (sp_ifa->rt && sp_ifa->rt->dst.dev == dev){
+                               ip6_del_rt(sp_ifa->rt);
+                       }

                        sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, false);

                        /* Failure cases are ignored */

  reply	other threads:[~2014-01-02  7:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-16  3:14 [PATCH] ipv6: don't call addrconf_dst_alloc again when enable lo Gao feng
2013-06-20  6:05 ` David Miller
2013-12-31  3:57   ` Hannes Frederic Sowa
2014-01-02  5:48     ` chenweilong
2014-01-02  6:03       ` Hannes Frederic Sowa
2014-01-02  8:13         ` chenweilong
2014-01-02  8:32           ` Hannes Frederic Sowa
2014-01-02  9:08             ` chenweilong
2014-01-02  6:54       ` Hannes Frederic Sowa
2014-01-02  7:58         ` chenweilong [this message]
2014-01-02  8:23           ` Hannes Frederic Sowa
2014-01-02  9:33             ` chenweilong
2014-01-03  6:53               ` Hannes Frederic Sowa
2014-01-08  7:50                 ` Gao feng
2014-01-08  8:05                   ` Hannes Frederic Sowa
2014-01-08  8:42                     ` Gao feng
2014-01-08  8:55                       ` Hannes Frederic Sowa
2014-01-17  2:02                         ` chenweilong
2014-01-17  4:09                           ` Hannes Frederic Sowa

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=52C51C1E.9040603@huawei.com \
    --to=chenweilong@huawei$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=gaofeng@cn$(echo .)fujitsu.com \
    --cc=hannes@stressinduktion$(echo .)org \
    --cc=kumaran.4353@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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