]> git.baikalelectronics.ru Git - kernel.git/commit
net: fix IPv6 prefix route residue
authorZhiqiang Liu <liuzhiqiang26@huawei.com>
Mon, 11 Feb 2019 02:57:46 +0000 (10:57 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Feb 2019 04:36:50 +0000 (20:36 -0800)
commit3d5ee5a8f6b2fc1d9bbbbe1016a6e6fdc331062d
treef2c00877d4108470b5f2eb461956e5a89e401ad0
parent7612d621313506ac2cf1a44bab50ec890f9e4cbc
net: fix IPv6 prefix route residue

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: 6b90086fb92a ("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>
net/ipv6/addrconf.c