]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: fix IPv6 prefix route residue
authorZhiqiang Liu <liuzhiqiang26@huawei.com>
Mon, 11 Feb 2019 02:57:46 +0000 (10:57 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 2 May 2019 20:41:51 +0000 (21:41 +0100)
commitda93eb476f54e0a3bc922ef4be62b51a720e915e
tree56674c2c86570a401a68dc6cae4e2b4616acfb7e
parent52faf09466e75f7e8812296e1cd47f6a67c87674
net: fix IPv6 prefix route residue

commit e75913c93f7cd5f338ab373c34c93a655bd309cb upstream.

Follow those steps:
 # ip addr add 2001:123::1/32 dev eth0
 # ip addr add 2001:123:456::2/64 dev eth0
 # ip addr del 2001:123::1/32 dev eth0
 # ip addr del 2001:123:456::2/64 dev eth0
and then prefix route of 2001:123::1/32 will still exist.

This is because ipv6_prefix_equal in check_cleanup_prefix_route
func does not check whether two IPv6 addresses have the same
prefix length. If the prefix of one address starts with another
shorter address prefix, even though their prefix lengths are
different, the return value of ipv6_prefix_equal is true.

Here I add a check of whether two addresses have the same prefix
to decide whether their prefixes are equal.

Fixes: 5b84efecb7d9 ("ipv6 addrconf: don't cleanup prefix route for IFA_F_NOPREFIXROUTE")
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Reported-by: Wenhao Zhang <zhangwenhao8@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/ipv6/addrconf.c