diff mbox

ipv6: don't call addrconf_dst_alloc again when enable lo

Message ID 1371352470-3226-1-git-send-email-gaofeng@cn.fujitsu.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Gao feng June 16, 2013, 3:14 a.m. UTC
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>
---
 net/ipv6/addrconf.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

David Miller June 20, 2013, 6:05 a.m. UTC | #1
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hannes Frederic Sowa Dec. 31, 2013, 3:57 a.m. UTC | #2
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.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
chenweilong Jan. 2, 2014, 5:48 a.m. UTC | #3
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.
> 
> 
> 
Hi,

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?

Thanks

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hannes Frederic Sowa Jan. 2, 2014, 6:03 a.m. UTC | #4
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?

It is designed this way.

Greetings,

  Hannes

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
chenweilong Jan. 2, 2014, 8:13 a.m. UTC | #5
On 2014/1/2 14:03, 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?
> 
> It is designed this way.
> 
> Greetings,
> 
>   Hannes
> 
> 
> .
> 
Can you give more explanation about this please?

Thanks!

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hannes Frederic Sowa Jan. 2, 2014, 8:32 a.m. UTC | #6
On Thu, Jan 02, 2014 at 04:13:40PM +0800, chenweilong wrote:
> Can you give more explanation about this please?

If you look at the routing table for local addresses (ip -6 route list table
local), you see that every address which is RTF_LOCAL (and thus passes up the
packets via ip6_input) has as its device the loopback device.

In case you shutdown loopback you clear all those routes, thus incoming
packets won't find the corresponding rt6_info which directs the packets to
passed up the stack.

I guess it was done to satisfy the scoped architecture of IPv6.

Does this help you?

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
chenweilong Jan. 2, 2014, 9:08 a.m. UTC | #7
On 2014/1/2 16:32, Hannes Frederic Sowa wrote:
> On Thu, Jan 02, 2014 at 04:13:40PM +0800, chenweilong wrote:
>> Can you give more explanation about this please?
> 
> If you look at the routing table for local addresses (ip -6 route list table
> local), you see that every address which is RTF_LOCAL (and thus passes up the
> packets via ip6_input) has as its device the loopback device.
> 
> In case you shutdown loopback you clear all those routes, thus incoming
> packets won't find the corresponding rt6_info which directs the packets to
> passed up the stack.
> 
> I guess it was done to satisfy the scoped architecture of IPv6.
> 
> Does this help you?
> 
> 
> 
Yes,thanks very much!


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 1bbf744..77b6261 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2655,6 +2655,9 @@  static void init_loopback(struct net_device *dev)
 			if (sp_ifa->flags & (IFA_F_DADFAILED | IFA_F_TENTATIVE))
 				continue;
 
+			if (sp_ifa->rt)
+				continue;
+
 			sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, 0);
 
 			/* Failure cases are ignored */