]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.19/tcp-do-not-use-ipv6-header-for-ipv4-flow.patch
5.0-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.19 / tcp-do-not-use-ipv6-header-for-ipv4-flow.patch
CommitLineData
38568109
GKH
1From foo@baz Thu Mar 28 21:54:17 CET 2019
2From: Eric Dumazet <edumazet@google.com>
3Date: Tue, 19 Mar 2019 05:45:35 -0700
4Subject: tcp: do not use ipv6 header for ipv4 flow
5
6From: Eric Dumazet <edumazet@google.com>
7
8[ Upstream commit 89e4130939a20304f4059ab72179da81f5347528 ]
9
10When a dual stack tcp listener accepts an ipv4 flow,
11it should not attempt to use an ipv6 header or tcp_v6_iif() helper.
12
13Fixes: 1397ed35f22d ("ipv6: add flowinfo for tcp6 pkt_options for all cases")
14Fixes: df3687ffc665 ("ipv6: add the IPV6_FL_F_REFLECT flag to IPV6_FL_A_GET")
15Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
16Signed-off-by: Eric Dumazet <edumazet@google.com>
17Signed-off-by: David S. Miller <davem@davemloft.net>
18Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19---
20 net/ipv6/tcp_ipv6.c | 8 ++++----
21 1 file changed, 4 insertions(+), 4 deletions(-)
22
23--- a/net/ipv6/tcp_ipv6.c
24+++ b/net/ipv6/tcp_ipv6.c
25@@ -1108,11 +1108,11 @@ static struct sock *tcp_v6_syn_recv_sock
26 newnp->ipv6_fl_list = NULL;
27 newnp->pktoptions = NULL;
28 newnp->opt = NULL;
29- newnp->mcast_oif = tcp_v6_iif(skb);
30- newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
31- newnp->rcv_flowinfo = ip6_flowinfo(ipv6_hdr(skb));
32+ newnp->mcast_oif = inet_iif(skb);
33+ newnp->mcast_hops = ip_hdr(skb)->ttl;
34+ newnp->rcv_flowinfo = 0;
35 if (np->repflow)
36- newnp->flow_label = ip6_flowlabel(ipv6_hdr(skb));
37+ newnp->flow_label = 0;
38
39 /*
40 * No need to charge this sock to the relevant IPv6 refcnt debug socks count