Skip to content

Commit 3ac9e29

Browse files
tobiasbrunnerklassert
authored andcommitted
xfrm: Set transport header to fix UDP GRO handling
The referenced commit replaced a call to __xfrm4|6_udp_encap_rcv() with a custom check for non-ESP markers. But what the called function also did was setting the transport header to the ESP header. The function that follows, esp4|6_gro_receive(), relies on that being set when it calls xfrm_parse_spi(). We have to set the full offset as the skb's head was not moved yet so adding just the UDP header length won't work. Fixes: e3fd057 ("xfrm: Fix UDP GRO handling for some corner cases") Signed-off-by: Tobias Brunner <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent c0f2102 commit 3ac9e29

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

net/ipv4/xfrm4_input.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ struct sk_buff *xfrm4_gro_udp_encap_rcv(struct sock *sk, struct list_head *head,
202202
if (len <= sizeof(struct ip_esp_hdr) || udpdata32[0] == 0)
203203
goto out;
204204

205+
/* set the transport header to ESP */
206+
skb_set_transport_header(skb, offset);
207+
205208
NAPI_GRO_CB(skb)->proto = IPPROTO_UDP;
206209

207210
pp = call_gro_receive(ops->callbacks.gro_receive, head, skb);

net/ipv6/xfrm6_input.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ struct sk_buff *xfrm6_gro_udp_encap_rcv(struct sock *sk, struct list_head *head,
202202
if (len <= sizeof(struct ip_esp_hdr) || udpdata32[0] == 0)
203203
goto out;
204204

205+
/* set the transport header to ESP */
206+
skb_set_transport_header(skb, offset);
207+
205208
NAPI_GRO_CB(skb)->proto = IPPROTO_UDP;
206209

207210
pp = call_gro_receive(ops->callbacks.gro_receive, head, skb);

0 commit comments

Comments
 (0)