]> git.baikalelectronics.ru Git - kernel.git/commit
xfrm: esp6: fix encapsulation header offset computation
authorSabrina Dubroca <sd@queasysnail.net>
Fri, 3 Jul 2020 14:57:09 +0000 (16:57 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Tue, 7 Jul 2020 06:19:46 +0000 (08:19 +0200)
commit5c8ab8510d8a74f88f014d3dab1f7f4360c1774a
treee59787c4d3b5ff06dda4f562cc5d0530b71cc26c
parent9e8aeab3334c3019b5b14673a15507160489592d
xfrm: esp6: fix encapsulation header offset computation

In commit 654d11700501, I incorrectly adapted the code that computes
the location of the UDP or TCP encapsulation header from IPv4 to
IPv6. In esp6_input_done2, skb->transport_header points to the ESP
header, so by adding skb_network_header_len, uh and th will point to
the ESP header, not the encapsulation header that's in front of it.

Since the TCP header's size can change with options, we have to start
from the IPv6 header and walk past possible extensions.

Fixes: 654d11700501 ("xfrm: add support for UDPv6 encapsulation of ESP")
Fixes: beaf74bfad15 ("xfrm: add IPv6 support for espintcp")
Reported-by: Tobias Brunner <tobias@strongswan.org>
Tested-by: Tobias Brunner <tobias@strongswan.org>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/ipv6/esp6.c