mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 05:02:12 +00:00
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>
This commit is contained in:
parent
515e12401f
commit
64c6d08e64
@ -788,10 +788,16 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
|
|||||||
struct in6_addr prefix;
|
struct in6_addr prefix;
|
||||||
struct rt6_info *rt;
|
struct rt6_info *rt;
|
||||||
struct net *net = dev_net(ifp->idev->dev);
|
struct net *net = dev_net(ifp->idev->dev);
|
||||||
ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len);
|
struct flowi6 fl6 = {};
|
||||||
rt = rt6_lookup(net, &prefix, NULL, ifp->idev->dev->ifindex, 1);
|
|
||||||
|
|
||||||
if (rt && addrconf_is_prefix_route(rt)) {
|
ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len);
|
||||||
|
fl6.flowi6_oif = ifp->idev->dev->ifindex;
|
||||||
|
fl6.daddr = prefix;
|
||||||
|
rt = (struct rt6_info *)ip6_route_lookup(net, &fl6,
|
||||||
|
RT6_LOOKUP_F_IFACE);
|
||||||
|
|
||||||
|
if (rt != net->ipv6.ip6_null_entry &&
|
||||||
|
addrconf_is_prefix_route(rt)) {
|
||||||
if (onlink == 0) {
|
if (onlink == 0) {
|
||||||
ip6_del_rt(rt);
|
ip6_del_rt(rt);
|
||||||
rt = NULL;
|
rt = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user