From: Sasha Levin Date: Thu, 21 Feb 2019 05:43:06 +0000 (-0500) Subject: patches for 3.18 X-Git-Tag: v3.18.136~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f794315b554a02c081f764755bf9b232a05a72ad;p=thirdparty%2Fkernel%2Fstable-queue.git patches for 3.18 Signed-off-by: Sasha Levin --- diff --git a/queue-3.18/net-fix-ipv6-prefix-route-residue.patch b/queue-3.18/net-fix-ipv6-prefix-route-residue.patch new file mode 100644 index 00000000000..cced651d21f --- /dev/null +++ b/queue-3.18/net-fix-ipv6-prefix-route-residue.patch @@ -0,0 +1,49 @@ +From a553a81746e7373d8829a5f7ed80a4b04dafb203 Mon Sep 17 00:00:00 2001 +From: Zhiqiang Liu +Date: Mon, 11 Feb 2019 10:57:46 +0800 +Subject: net: fix IPv6 prefix route residue + +[ 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: 5b84efecb7d9 ("ipv6 addrconf: don't cleanup prefix route for IFA_F_NOPREFIXROUTE") +Signed-off-by: Zhiqiang Liu +Reported-by: Wenhao Zhang +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ipv6/addrconf.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c +index 78dd9ce1214f7..bbc5dd769ebcd 100644 +--- a/net/ipv6/addrconf.c ++++ b/net/ipv6/addrconf.c +@@ -949,7 +949,8 @@ check_cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long *expires) + list_for_each_entry(ifa, &idev->addr_list, if_list) { + if (ifa == ifp) + continue; +- if (!ipv6_prefix_equal(&ifa->addr, &ifp->addr, ++ if (ifa->prefix_len != ifp->prefix_len || ++ !ipv6_prefix_equal(&ifa->addr, &ifp->addr, + ifp->prefix_len)) + continue; + if (ifa->flags & (IFA_F_PERMANENT | IFA_F_NOPREFIXROUTE)) +-- +2.19.1 + diff --git a/queue-3.18/series b/queue-3.18/series new file mode 100644 index 00000000000..9aaeefacddd --- /dev/null +++ b/queue-3.18/series @@ -0,0 +1 @@ +net-fix-ipv6-prefix-route-residue.patch