[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52E0B55F.4070501@cn.fujitsu.com>
Date: Thu, 23 Jan 2014 14:23:27 +0800
From: Gao feng <gaofeng@...fujitsu.com>
To: Sabrina Dubroca <sd@...asysnail.net>, netdev@...r.kernel.org,
Hannes Frederic Sowa <hannes@...essinduktion.org>
Subject: Re: [RFC PATCH net] IPv6: Fix broken IPv6 routing table after loopback
down-up
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists