• Zhiqiang Liu's avatar
    net: fix IPv6 prefix route residue · 9467d98f
    Zhiqiang Liu authored
    [ Upstream commit e75913c93f7cd5f338ab373c34c93a655bd309cb ]
    
    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: 5b84efec ("ipv6 addrconf: don't cleanup prefix route for IFA_F_NOPREFIXROUTE")
    Signed-off-by: 's avatarZhiqiang Liu <liuzhiqiang26@huawei.com>
    Reported-by: 's avatarWenhao Zhang <zhangwenhao8@huawei.com>
    Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: 's avatarSasha Levin <sashal@kernel.org>
    9467d98f
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...
REPORTING-BUGS Loading commit data...