Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
udp: Compute L4 checksum as usual when not segmenting the skb
Browse files Browse the repository at this point in the history
commit d96016a upstream.

If:

  1) the user requested USO, but
  2) there is not enough payload for GSO to kick in, and
  3) the egress device doesn't offer checksum offload, then

we want to compute the L4 checksum in software early on.

In the case when we are not taking the GSO path, but it has been requested,
the software checksum fallback in skb_segment doesn't get a chance to
compute the full checksum, if the egress device can't do it. As a result we
end up sending UDP datagrams with only a partial checksum filled in, which
the peer will discard.

Fixes: 10154db ("udp: Allow GSO transmit from devices with no checksum offload")
Reported-by: Ivan Babrou <[email protected]>
Signed-off-by: Jakub Sitnicki <[email protected]>
Acked-by: Willem de Bruijn <[email protected]>
Cc: [email protected]
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
jsitnicki authored and gregkh committed Oct 22, 2024
1 parent 1ff7247 commit 8dec576
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion net/ipv4/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,8 +950,10 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4,
skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(datalen,
cork->gso_size);

/* Don't checksum the payload, skb will get segmented */
goto csum_partial;
}
goto csum_partial;
}

if (is_udplite) /* UDP-Lite */
Expand Down
4 changes: 3 additions & 1 deletion net/ipv6/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1266,8 +1266,10 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6,
skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(datalen,
cork->gso_size);

/* Don't checksum the payload, skb will get segmented */
goto csum_partial;
}
goto csum_partial;
}

if (is_udplite)
Expand Down

0 comments on commit 8dec576

Please sign in to comment.