linux/drivers/net/wireguard
Alice Mikityanska 5329647dad net: Use helpers to get/set UDP len tree-wide
Since BIG TCP for UDP tunnels will start using len=0 in the UDP header
as an indicator of a GSO packet bigger than 65535 bytes, this commit
introduces the following getter and setters to use tree-wide, in order
to explicitly mark places where len=0 may be expected, and handle them
properly:

1. udp_set_len() sets uh->len to its real value if it's not bigger than
65535, and to 0 otherwise: to be used in GSO context with aggregated
packets.

2. udp_set_len_short() is to be used when the length is known to fit 16
bits. It WARNs when the caller tries to assign a bigger value if
CONFIG_DEBUG_NET=y.

3. udp_get_len_short() returns len in host byte order: to be used on the
RX side to deal with non-aggregated packets, or to access the raw value
of the len field.

4. udp_get_len() decodes uh->len set by udp_set_len(). It checks whether
the packet is GSO to guard from malformed packets.

At the moment udp_set_len() is not used, a following commit will start
using it after enabling len>65535 for GSO.

Raw uh->len (in network byte order) is still accessed in a few places
for checksum calculation purposes, and to decode len=0 in udpv6_rcv for
jumbograms. udp_rcv and udpv6_rcv will be addressed by the commit that
starts using udp_set_len() to set UDP len=0 for BIG TCP packets in UDP
tunnels.

Signed-off-by: Alice Mikityanska <alice@isovalent.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Acked-by: Jason A. Donenfeld <Jason@zx2c4.com>
Link: https://patch.msgid.link/20260710134242.216538-2-alice.kernel@fastmail.im
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-22 13:47:02 +02:00
..
generated wireguard: netlink: generate netlink code 2025-12-02 04:12:49 +01:00
selftest wireguard: allowedips: remove redundant space 2026-04-14 11:48:04 -07:00
allowedips.c wireguard: allowedips: Use kfree_rcu() instead of call_rcu() 2026-04-14 11:48:04 -07:00
allowedips.h wireguard: allowedips: add WGALLOWEDIP_F_REMOVE_ME flag 2025-05-27 09:06:19 +02:00
cookie.c lib/crypto: blake2s: Rename blake2s_state to blake2s_ctx 2025-10-29 22:04:24 -07:00
cookie.h
device.c wireguard: device: use exit_rtnl callback instead of manual rtnl_lock in pre_exit 2026-04-14 11:48:04 -07:00
device.h wireguard: receive: use ring buffer for incoming handshakes 2021-11-29 19:50:50 -08:00
main.c genetlink: remove linux/genetlink.h 2024-04-01 21:44:34 -07:00
Makefile wireguard: netlink: generate netlink code 2025-12-02 04:12:49 +01:00
messages.h wireguard: queueing: preserve flow hash across packet scrubbing 2020-05-20 20:55:09 -07:00
netlink.c wireguard: netlink: generate netlink code 2025-12-02 04:12:49 +01:00
netlink.h
noise.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
noise.h wireguard: noise: separate receive counter from send counter 2020-05-20 20:55:09 -07:00
peer.c net: drop the weight argument from netif_napi_add 2022-09-28 18:57:14 -07:00
peer.h wireguard: peer: Replace sockaddr with sockaddr_inet 2025-07-25 15:29:58 -07:00
peerlookup.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
peerlookup.h
queueing.c wireguard: queueing: use saner cpu selection wrapping 2023-07-03 09:17:52 +01:00
queueing.h wireguard: queueing: always return valid online CPU in wg_cpumask_choose_online() 2025-09-11 18:52:21 -07:00
ratelimiter.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ratelimiter.h
receive.c net: Use helpers to get/set UDP len tree-wide 2026-07-22 13:47:02 +02:00
send.c wireguard: send: append trailer after expanding head 2026-05-29 13:01:27 -07:00
socket.c udp_tunnel: Pass struct sock to setup_udp_tunnel_sock(). 2026-05-05 17:47:04 -07:00
socket.h
timers.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
timers.h
version.h