From: Eric Dumazet <eric.dumazet@gmail.com>
To: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: netdev@vger.kernel.org, yoshfuji@linux-ipv6.org, davem@davemloft.net
Subject: Re: [PATCH] ipv6: del unreachable route when an addr is deleted on lo
Date: Tue, 25 Sep 2012 15:43:51 +0200 [thread overview]
Message-ID: <1348580631.26828.3047.camel@edumazet-glaptop> (raw)
In-Reply-To: <1348568699-3932-1-git-send-email-nicolas.dichtel@6wind.com>
On Tue, 2012-09-25 at 12:24 +0200, Nicolas Dichtel wrote:
> When an address is added on loopback (ip -6 a a 2002::1/128 dev lo), two routes
> are added:
> - one in the local table:
> local 2002::1 via :: dev lo proto none metric 0
> - one the in main table (for the prefix):
> unreachable 2002::1 dev lo proto kernel metric 256 error -101
>
> When the address is deleted, the route inserted in the main table remains
> because we use rt6_lookup(), which returns NULL when dst->error is set, which
> is the case here! Thus, it is better to use ip6_route_lookup() to avoid this
> kind of filter.
>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> net/ipv6/addrconf.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 6bc85f7..b6b2f9f 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -788,8 +788,12 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
> struct in6_addr prefix;
> struct rt6_info *rt;
> struct net *net = dev_net(ifp->idev->dev);
> + struct flowi6 fl6 = {};
> ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len);
> - rt = rt6_lookup(net, &prefix, NULL, ifp->idev->dev->ifindex, 1);
> + fl6.flowi6_oif = ifp->idev->dev->ifindex;
> + fl6.daddr = prefix;
> + rt = (struct rt6_info *)ip6_route_lookup(net, &fl6,
> + RT6_LOOKUP_F_IFACE);
>
rt cant be NULL here ( but can be ip6_null_entry )
> if (rt && addrconf_is_prefix_route(rt)) {
So this condition is obsolete...
next prev parent reply other threads:[~2012-09-25 13:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-25 10:24 [PATCH] ipv6: del unreachable route when an addr is deleted on lo Nicolas Dichtel
2012-09-25 13:43 ` Eric Dumazet [this message]
2012-09-26 10:04 ` [PATCH v2] " Nicolas Dichtel
2012-10-01 20:49 ` 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=1348580631.26828.3047.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=yoshfuji@linux-ipv6.org \
/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