From: Greg Kroah-Hartman Date: Thu, 21 Nov 2019 22:13:58 +0000 (+0100) Subject: drop ipv4-reset-rt_iif-for-recirculated-mcast-bcast-out-pkts.patch from 4.19 and... X-Git-Tag: v5.3.13~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fb8dc6bbd1733b077e213aa2f22c81ef3f1792b0;p=thirdparty%2Fkernel%2Fstable-queue.git drop ipv4-reset-rt_iif-for-recirculated-mcast-bcast-out-pkts.patch from 4.19 and 4.14 --- diff --git a/queue-4.14/ipv4-reset-rt_iif-for-recirculated-mcast-bcast-out-pkts.patch b/queue-4.14/ipv4-reset-rt_iif-for-recirculated-mcast-bcast-out-pkts.patch deleted file mode 100644 index 82bc3099fc8..00000000000 --- a/queue-4.14/ipv4-reset-rt_iif-for-recirculated-mcast-bcast-out-pkts.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 5b18f1289808fee5d04a7e6ecf200189f41a4db6 Mon Sep 17 00:00:00 2001 -From: Stephen Suryaputra -Date: Wed, 26 Jun 2019 02:21:16 -0400 -Subject: ipv4: reset rt_iif for recirculated mcast/bcast out pkts - -From: Stephen Suryaputra - -commit 5b18f1289808fee5d04a7e6ecf200189f41a4db6 upstream. - -Multicast or broadcast egress packets have rt_iif set to the oif. These -packets might be recirculated back as input and lookup to the raw -sockets may fail because they are bound to the incoming interface -(skb_iif). If rt_iif is not zero, during the lookup, inet_iif() function -returns rt_iif instead of skb_iif. Hence, the lookup fails. - -v2: Make it non vrf specific (David Ahern). Reword the changelog to - reflect it. -Signed-off-by: Stephen Suryaputra -Reviewed-by: David Ahern -Signed-off-by: David S. Miller -Signed-off-by: Greg Kroah-Hartman - ---- - include/net/route.h | 1 + - net/ipv4/ip_output.c | 12 ++++++++++++ - net/ipv4/route.c | 33 +++++++++++++++++++++++++++++++++ - 3 files changed, 46 insertions(+) - ---- a/include/net/route.h -+++ b/include/net/route.h -@@ -223,6 +223,7 @@ void ip_rt_get_source(u8 *src, struct sk - struct rtable *rt_dst_alloc(struct net_device *dev, - unsigned int flags, u16 type, - bool nopolicy, bool noxfrm, bool will_cache); -+struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt); - - struct in_ifaddr; - void fib_add_ifaddr(struct in_ifaddr *); ---- a/net/ipv4/ip_output.c -+++ b/net/ipv4/ip_output.c -@@ -320,6 +320,7 @@ static int ip_finish_output(struct net * - static int ip_mc_finish_output(struct net *net, struct sock *sk, - struct sk_buff *skb) - { -+ struct rtable *new_rt; - int ret; - - ret = BPF_CGROUP_RUN_PROG_INET_EGRESS(sk, skb); -@@ -328,6 +329,17 @@ static int ip_mc_finish_output(struct ne - return ret; - } - -+ /* Reset rt_iif so that inet_iif() will return skb->skb_iif. Setting -+ * this to non-zero causes ipi_ifindex in in_pktinfo to be overwritten, -+ * see ipv4_pktinfo_prepare(). -+ */ -+ new_rt = rt_dst_clone(net->loopback_dev, skb_rtable(skb)); -+ if (new_rt) { -+ new_rt->rt_iif = 0; -+ skb_dst_drop(skb); -+ skb_dst_set(skb, &new_rt->dst); -+ } -+ - return dev_loopback_xmit(net, sk, skb); - } - ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -1607,6 +1607,39 @@ struct rtable *rt_dst_alloc(struct net_d - } - EXPORT_SYMBOL(rt_dst_alloc); - -+struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt) -+{ -+ struct rtable *new_rt; -+ -+ new_rt = dst_alloc(&ipv4_dst_ops, dev, 1, DST_OBSOLETE_FORCE_CHK, -+ rt->dst.flags); -+ -+ if (new_rt) { -+ new_rt->rt_genid = rt_genid_ipv4(dev_net(dev)); -+ new_rt->rt_flags = rt->rt_flags; -+ new_rt->rt_type = rt->rt_type; -+ new_rt->rt_is_input = rt->rt_is_input; -+ new_rt->rt_iif = rt->rt_iif; -+ new_rt->rt_pmtu = rt->rt_pmtu; -+ new_rt->rt_mtu_locked = rt->rt_mtu_locked; -+ new_rt->rt_gw_family = rt->rt_gw_family; -+ if (rt->rt_gw_family == AF_INET) -+ new_rt->rt_gw4 = rt->rt_gw4; -+ else if (rt->rt_gw_family == AF_INET6) -+ new_rt->rt_gw6 = rt->rt_gw6; -+ INIT_LIST_HEAD(&new_rt->rt_uncached); -+ -+ new_rt->dst.flags |= DST_HOST; -+ new_rt->dst.input = rt->dst.input; -+ new_rt->dst.output = rt->dst.output; -+ new_rt->dst.error = rt->dst.error; -+ new_rt->dst.lastuse = jiffies; -+ new_rt->dst.lwtstate = lwtstate_get(rt->dst.lwtstate); -+ } -+ return new_rt; -+} -+EXPORT_SYMBOL(rt_dst_clone); -+ - /* called in rcu_read_lock() section */ - int ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr, - u8 tos, struct net_device *dev, diff --git a/queue-4.14/series b/queue-4.14/series index d36a7840d2e..06e8233b67e 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -7,4 +7,3 @@ mm-memory_hotplug-don-t-access-uninitialized-memmaps-in-shrink_pgdat_span.patch mm-memory_hotplug-fix-updating-the-node-span.patch arm64-uaccess-ensure-pan-is-re-enabled-after-unhandled-uaccess-fault.patch fbdev-ditch-fb_edid_add_monspecs.patch -ipv4-reset-rt_iif-for-recirculated-mcast-bcast-out-pkts.patch diff --git a/queue-4.19/ipv4-reset-rt_iif-for-recirculated-mcast-bcast-out-pkts.patch b/queue-4.19/ipv4-reset-rt_iif-for-recirculated-mcast-bcast-out-pkts.patch deleted file mode 100644 index eda12c0c3e0..00000000000 --- a/queue-4.19/ipv4-reset-rt_iif-for-recirculated-mcast-bcast-out-pkts.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 5b18f1289808fee5d04a7e6ecf200189f41a4db6 Mon Sep 17 00:00:00 2001 -From: Stephen Suryaputra -Date: Wed, 26 Jun 2019 02:21:16 -0400 -Subject: ipv4: reset rt_iif for recirculated mcast/bcast out pkts - -From: Stephen Suryaputra - -commit 5b18f1289808fee5d04a7e6ecf200189f41a4db6 upstream. - -Multicast or broadcast egress packets have rt_iif set to the oif. These -packets might be recirculated back as input and lookup to the raw -sockets may fail because they are bound to the incoming interface -(skb_iif). If rt_iif is not zero, during the lookup, inet_iif() function -returns rt_iif instead of skb_iif. Hence, the lookup fails. - -v2: Make it non vrf specific (David Ahern). Reword the changelog to - reflect it. -Signed-off-by: Stephen Suryaputra -Reviewed-by: David Ahern -Signed-off-by: David S. Miller -Signed-off-by: Greg Kroah-Hartman - ---- - include/net/route.h | 1 + - net/ipv4/ip_output.c | 12 ++++++++++++ - net/ipv4/route.c | 33 +++++++++++++++++++++++++++++++++ - 3 files changed, 46 insertions(+) - ---- a/include/net/route.h -+++ b/include/net/route.h -@@ -221,6 +221,7 @@ void ip_rt_get_source(u8 *src, struct sk - struct rtable *rt_dst_alloc(struct net_device *dev, - unsigned int flags, u16 type, - bool nopolicy, bool noxfrm, bool will_cache); -+struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt); - - struct in_ifaddr; - void fib_add_ifaddr(struct in_ifaddr *); ---- a/net/ipv4/ip_output.c -+++ b/net/ipv4/ip_output.c -@@ -320,6 +320,7 @@ static int ip_finish_output(struct net * - static int ip_mc_finish_output(struct net *net, struct sock *sk, - struct sk_buff *skb) - { -+ struct rtable *new_rt; - int ret; - - ret = BPF_CGROUP_RUN_PROG_INET_EGRESS(sk, skb); -@@ -328,6 +329,17 @@ static int ip_mc_finish_output(struct ne - return ret; - } - -+ /* Reset rt_iif so that inet_iif() will return skb->skb_iif. Setting -+ * this to non-zero causes ipi_ifindex in in_pktinfo to be overwritten, -+ * see ipv4_pktinfo_prepare(). -+ */ -+ new_rt = rt_dst_clone(net->loopback_dev, skb_rtable(skb)); -+ if (new_rt) { -+ new_rt->rt_iif = 0; -+ skb_dst_drop(skb); -+ skb_dst_set(skb, &new_rt->dst); -+ } -+ - return dev_loopback_xmit(net, sk, skb); - } - ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -1636,6 +1636,39 @@ struct rtable *rt_dst_alloc(struct net_d - } - EXPORT_SYMBOL(rt_dst_alloc); - -+struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt) -+{ -+ struct rtable *new_rt; -+ -+ new_rt = dst_alloc(&ipv4_dst_ops, dev, 1, DST_OBSOLETE_FORCE_CHK, -+ rt->dst.flags); -+ -+ if (new_rt) { -+ new_rt->rt_genid = rt_genid_ipv4(dev_net(dev)); -+ new_rt->rt_flags = rt->rt_flags; -+ new_rt->rt_type = rt->rt_type; -+ new_rt->rt_is_input = rt->rt_is_input; -+ new_rt->rt_iif = rt->rt_iif; -+ new_rt->rt_pmtu = rt->rt_pmtu; -+ new_rt->rt_mtu_locked = rt->rt_mtu_locked; -+ new_rt->rt_gw_family = rt->rt_gw_family; -+ if (rt->rt_gw_family == AF_INET) -+ new_rt->rt_gw4 = rt->rt_gw4; -+ else if (rt->rt_gw_family == AF_INET6) -+ new_rt->rt_gw6 = rt->rt_gw6; -+ INIT_LIST_HEAD(&new_rt->rt_uncached); -+ -+ new_rt->dst.flags |= DST_HOST; -+ new_rt->dst.input = rt->dst.input; -+ new_rt->dst.output = rt->dst.output; -+ new_rt->dst.error = rt->dst.error; -+ new_rt->dst.lastuse = jiffies; -+ new_rt->dst.lwtstate = lwtstate_get(rt->dst.lwtstate); -+ } -+ return new_rt; -+} -+EXPORT_SYMBOL(rt_dst_clone); -+ - /* called in rcu_read_lock() section */ - int ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr, - u8 tos, struct net_device *dev, diff --git a/queue-4.19/series b/queue-4.19/series index e7c3bd48f12..e7caf57e728 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -8,4 +8,3 @@ mm-memory_hotplug-don-t-access-uninitialized-memmaps-in-shrink_pgdat_span.patch mm-memory_hotplug-fix-updating-the-node-span.patch arm64-uaccess-ensure-pan-is-re-enabled-after-unhandled-uaccess-fault.patch fbdev-ditch-fb_edid_add_monspecs.patch -ipv4-reset-rt_iif-for-recirculated-mcast-bcast-out-pkts.patch