• Z
    net: fix IPv6 prefix route residue · bab43ffa
    Zhiqiang Liu 提交于
    mainline inclusion
    from mainline-v5.0-rc7
    commit e75913c93f7c
    category: bugfix
    bugzilla: 9533
    CVE: NA
    
    -------------------------------------------------
    
    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: NZhiqiang Liu <liuzhiqiang26@huawei.com>
    Reported-by: NWenhao Zhang <zhangwenhao8@huawei.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    Reviewed-by: NMao Wenan <maowenan@huawei.com>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    bab43ffa
addrconf.c 164.7 KB