Skip to content

Commit 5c2c3c3

Browse files
Paolo Abenikuba-moo
authored andcommitted
net: gro: fix outer network offset
The udp GRO complete stage assumes that all the packets inserted the RX have the `encapsulation` flag zeroed. Such assumption is not true, as a few H/W NICs can set such flag when H/W offloading the checksum for an UDP encapsulated traffic, the tun driver can inject GSO packets with UDP encapsulation and the problematic layout can also be created via a veth based setup. Due to the above, in the problematic scenarios, udp4_gro_complete() uses the wrong network offset (inner instead of outer) to compute the outer UDP header pseudo checksum, leading to csum validation errors later on in packet processing. Address the issue always clearing the encapsulation flag at GRO completion time. Such flag will be set again as needed for encapsulated packets by udp_gro_complete(). Fixes: 5ef31ea ("net: gro: fix udp bad offset in socket lookup by adding {inner_}network_offset to napi_gro_cb") Reviewed-by: Willem de Bruijn <[email protected]> Signed-off-by: Paolo Abeni <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Link: https://patch.msgid.link/562638dbebb3b15424220e26a180274b387e2a88.1770032084.git.pabeni@redhat.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f613e8b commit 5c2c3c3

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

net/core/gro.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ static void gro_complete(struct gro_node *gro, struct sk_buff *skb)
265265
goto out;
266266
}
267267

268+
/* NICs can feed encapsulated packets into GRO */
269+
skb->encapsulation = 0;
268270
rcu_read_lock();
269271
list_for_each_entry_rcu(ptype, head, list) {
270272
if (ptype->type != type || !ptype->callbacks.gro_complete)

0 commit comments

Comments
 (0)