From: Gao feng <gaofeng@cn.fujitsu.com>
To: Sabrina Dubroca <sd@queasysnail.net>,
netdev@vger.kernel.org,
Hannes Frederic Sowa <hannes@stressinduktion.org>
Subject: Re: [RFC PATCH net] IPv6: Fix broken IPv6 routing table after loopback down-up
Date: Thu, 23 Jan 2014 14:23:27 +0800 [thread overview]
Message-ID: <52E0B55F.4070501@cn.fujitsu.com> (raw)
In-Reply-To: <20140123010123.GF7269@order.stressinduktion.org>
On 01/23/2014 09:01 AM, Hannes Frederic Sowa wrote:
> On Thu, Jan 23, 2014 at 08:56:37AM +0800, Gao feng wrote:
>> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
>> index 1a341f7..4dca886 100644
>> --- a/net/ipv6/addrconf.c
>> +++ b/net/ipv6/addrconf.c
>> @@ -2610,8 +2610,16 @@ 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) {
>> + /* This dst has been added to garbage list when
>> + * lo device down, delete this obsolete dst and
>> + * reallocate new router for ifa. */
>> + if (sp_ifa->rt->dst.obsolete > 0) {
>> + ip6_del_rt(sp_ifa->rt);
>> + sp_ifa->rt = NULL;
>> + } else
>> + continue;
>> + }
>>
>> sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, false);
>
> I agree, this seems a lot simpler.
I will post a official version.
> In the end I would like to replace this
> conditional loopback up/down thing with something like below. I haven't done
> the correct hookups into the relevant places, but I hope you get the idea:
>
The code explains everything. the routers will be invalid when device is down
and be enabled when device is up.
look forward to your patch.
> diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
> index 017badb..1648a59a 100644
> --- a/include/net/ip6_route.h
> +++ b/include/net/ip6_route.h
[...]
>
> -static int fib6_ifdown(struct rt6_info *rt, void *arg)
> +static int __fib6_match_or_update_if(struct rt6_info *rt, void *arg)
> {
> const struct arg_dev_net *adn = arg;
> const struct net_device *dev = adn->dev;
>
> if ((rt->dst.dev == dev || !dev) &&
> - rt != adn->net->ipv6.ip6_null_entry)
> - return -1;
> + rt != adn->net->ipv6.ip6_null_entry) {
> + switch (adn->action) {
> + case ARG_DEV_NET_REMOVE:
> + /* remove rt */
> + return -1;
> + case ARG_DEV_NET_DISABLE:
> + WARN_ON(rt->rt6i_flags & RTF_DEAD);
> + rt->rt6i_flags |= RTF_DEAD;
> + return 0;
> + case ARG_DEV_NET_ENABLE:
> + WARN_ON(!(rt->rt6i_flags & RTF_DEAD));
I think this may happen, think a new router is cloned from this rt but hasn't been inserted
into the router tree on other CPU at the same time.
next prev parent reply other threads:[~2014-01-23 6:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-22 15:35 [RFC PATCH net] IPv6: Fix broken IPv6 routing table after loopback down-up Sabrina Dubroca
2014-01-22 16:20 ` Eric Dumazet
2014-01-22 21:34 ` Hannes Frederic Sowa
2014-01-23 0:56 ` Gao feng
2014-01-23 1:01 ` Hannes Frederic Sowa
2014-01-23 6:23 ` Gao feng [this message]
2014-01-23 14:11 ` 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=52E0B55F.4070501@cn.fujitsu.com \
--to=gaofeng@cn.fujitsu.com \
--cc=hannes@stressinduktion.org \
--cc=netdev@vger.kernel.org \
--cc=sd@queasysnail.net \
/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).