diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2012-09-25 20:04:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-10-01 16:49:23 -0400 |
commit | 64c6d08e6490fb18cea09bb03686c149946bd818 (patch) | |
tree | b831092af305441c9639796e9c5e68027bdc345d /net/ipv6 | |
parent | 515e12401f43f2fe7511d228dfe3e186be8aab6e (diff) |
ipv6: del unreachable route when an addr is deleted on lo
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/addrconf.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 719a828fb67f..480e68422efb 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -788,10 +788,16 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) | |||
788 | struct in6_addr prefix; | 788 | struct in6_addr prefix; |
789 | struct rt6_info *rt; | 789 | struct rt6_info *rt; |
790 | struct net *net = dev_net(ifp->idev->dev); | 790 | struct net *net = dev_net(ifp->idev->dev); |
791 | struct flowi6 fl6 = {}; | ||
792 | |||
791 | ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len); | 793 | ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len); |
792 | rt = rt6_lookup(net, &prefix, NULL, ifp->idev->dev->ifindex, 1); | 794 | fl6.flowi6_oif = ifp->idev->dev->ifindex; |
795 | fl6.daddr = prefix; | ||
796 | rt = (struct rt6_info *)ip6_route_lookup(net, &fl6, | ||
797 | RT6_LOOKUP_F_IFACE); | ||
793 | 798 | ||
794 | if (rt && addrconf_is_prefix_route(rt)) { | 799 | if (rt != net->ipv6.ip6_null_entry && |
800 | addrconf_is_prefix_route(rt)) { | ||
795 | if (onlink == 0) { | 801 | if (onlink == 0) { |
796 | ip6_del_rt(rt); | 802 | ip6_del_rt(rt); |
797 | rt = NULL; | 803 | rt = NULL; |