Skip to content

Commit 5d0ff54

Browse files
strssndktnklassert
authored andcommitted
ipv6: xfrm: dereference inner ipv6 header if encapsulated
In xfrm6_local_error use inner_header if the packet was encapsulated. Cc: Steffen Klassert <steffen.klassert@secunet.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
1 parent 3d48305 commit 5d0ff54

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/ipv6/xfrm6_output.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,12 @@ static void xfrm6_local_rxpmtu(struct sk_buff *skb, u32 mtu)
5959
void xfrm6_local_error(struct sk_buff *skb, u32 mtu)
6060
{
6161
struct flowi6 fl6;
62+
const struct ipv6hdr *hdr;
6263
struct sock *sk = skb->sk;
6364

65+
hdr = skb->encapsulation ? inner_ipv6_hdr(skb) : ipv6_hdr(skb);
6466
fl6.fl6_dport = inet_sk(sk)->inet_dport;
65-
fl6.daddr = ipv6_hdr(skb)->daddr;
67+
fl6.daddr = hdr->daddr;
6668

6769
ipv6_local_error(sk, EMSGSIZE, &fl6, mtu);
6870
}

0 commit comments

Comments
 (0)