]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.110/tcp-do-not-use-ipv6-header-for-ipv4-flow.patch
Linux 4.9.167
[thirdparty/kernel/stable-queue.git] / releases / 4.14.110 / tcp-do-not-use-ipv6-header-for-ipv4-flow.patch
1 From foo@baz Thu Mar 28 21:57:57 CET 2019
2 From: Eric Dumazet <edumazet@google.com>
3 Date: Tue, 19 Mar 2019 05:45:35 -0700
4 Subject: tcp: do not use ipv6 header for ipv4 flow
5
6 From: Eric Dumazet <edumazet@google.com>
7
8 [ Upstream commit 89e4130939a20304f4059ab72179da81f5347528 ]
9
10 When a dual stack tcp listener accepts an ipv4 flow,
11 it should not attempt to use an ipv6 header or tcp_v6_iif() helper.
12
13 Fixes: 1397ed35f22d ("ipv6: add flowinfo for tcp6 pkt_options for all cases")
14 Fixes: df3687ffc665 ("ipv6: add the IPV6_FL_F_REFLECT flag to IPV6_FL_A_GET")
15 Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
16 Signed-off-by: Eric Dumazet <edumazet@google.com>
17 Signed-off-by: David S. Miller <davem@davemloft.net>
18 Signed-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 @@ -1083,11 +1083,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