[PATCH net v5 0/8] psp, tls: don't send offloaded contents in cleartext
From: Todd Freed
Date: Tue Nov 10 2026 - 19:21:37 EST
While working on adding support for socket-less psp associations, I
noticed the case of ipv6 extension headers was not being handled
properly for psp packets. It will be relevant with that series, because
it adds udp support, for which the psp nexthdr needs to look at the
inner packet.
That led me to various other ways where packets on the crypto offload
path could be transmitted unencrypted.
Since the psp/tls association encodes intent to send encrypted packets,
but these various cases circumvent that, sending these as fixes.
The cases are,
1/ ipv6 extension headers (patch 2; patch 1 makes mlx5e flush its tx
queue when the resulting drop happens),
2/ fragments (patch 3),
3/ icmp errors (patch 4),
4/ icmpv6 errors (patch 5),
Cases 2, 3 and 4 are relevant for ktls as well as psp.
patch 8 fixes an mlx5e bug in tso checksum calculation for psp packets
when the l3 dest is an intermediate hop (ipv4 source routing). It's not
about preventing unencrypted tx, so could be considered separate.
netfilter refragments bridged packets and builds reject replies itself,
outside these paths. A separate series to nf-next, which follows this
one, applies the same rules there.
Testing:
all hardware testing was done on connectx-7 (fw 28.48), between two x86
hosts, plus netdevsim.
- drivers/net psp.py: on netdevsim, all 36 tests pass. on mlx5, 30
pass, 4 skip (gmac versions the device doesn't support), and 2 xfail
(netdevsim only).
- tso checksum seed: a psp tcp socket with an ipv4 loose source route,
the peer checking tcp checksums in software. hundreds of checksum
errors before the fix, none after.
- fragments, with tls offload and psp:
- ipv4 (route mtu above the device mtu, IP_PMTUDISC_OMIT): without
the fix, some fragments after the first go out in cleartext. with
it they're dropped.
- ipv6, through an ipvs dr service with a local client: without the
fix, fragments after the first go out in cleartext, and the peer
reassembles them. with it they're dropped.
- icmp and icmpv6 errors, on netdevsim psp, with an nft reject rule
(icmpx port-unreachable):
- in an input chain, of received decrypted packets: without the fix,
the errors go out on the wire, quoting the decrypted packets. with
it, no error reaches the wire.
- in an output chain, of a psp socket's packets: the error is
delivered to the local socket, with and without the fix.
- a PKT_TOOBIG from ip6_fragment() about a psp socket's packets is
delivered to the socket, with and without the fix.
v5:
- new patch 1: mlx5e rings the tx doorbell when an accel offload drops
a packet, and checks the stop room after the nop it posts (Sashiko)
- ipv6 extension headers: drop them in psp_dev_encapsulate() again,
instead of in mlx5e. it's the helper which can't encapsulate them,
for every driver (netdevsim sent them malformed). unlike the routing
header rejection in v2, this isn't a device limitation
- don't fragment decrypted skbs in ip6_fragment() either
- icmp and icmpv6: send no error at all about a received decrypted skb,
instead of quoting up to the tcp header for tls offload.
- icmpv6: decide whether an error about a locally originated skb goes
to a local address from the error's route (RTF_LOCAL), like icmp
(RTCF_LOCAL), instead of the address list (Sashiko)
- selftests: the extension header test runs on netdevsim too, and
removes the socket option before closing. the fragment test uses the
source address of the route, and turns off tcp_mtu_probing
v4: https://lore.kernel.org/netdev/20261103001143.246081-1-toddfreed@xxxxxxxx
- back to dropping ipv6 packets with extension headers, but moved into
mlx5e instead of psp_dev_encapsulate()
- drop the psp core changes to rx and tx ipv6 extension headers
- new patch 2 to drop decrypted skbs instead of fragmenting
- new patches 3 and 4 to prevent quoting just-decrypted packet contents
in icmp errors, v4 and v6 respectively (Jakub, Bjorn, Sashiko)
- new selftest: ipv4 fragments of a psp tcp socket
v3: https://lore.kernel.org/netdev/20261023234640.1459291-1-toddfreed@xxxxxxxx
- new patch 1 to fix tso checksum seed calculation in mlx5e (Daniel)
- accept routing headers and reject ah (Daniel)
- split the psp_dev_rcv() change into its own patch (Daniel)
- return -EINVAL instead of -1 (Daniel)
- selftest: one variant per extension header type (Daniel)
v2: https://lore.kernel.org/netdev/20261022223014.556388-1-toddfreed@xxxxxxxx
- walk the extension headers instead of dropping (Daniel)
- reject fragment headers (Bjorn, Daniel)
- reject routing headers
- psp_dev_rcv() handle the rx case as well
v1: https://lore.kernel.org/netdev/20261021210200.788191-1-toddfreed@xxxxxxxx
Todd Freed (8):
net/mlx5e: ring the tx doorbell when an accel offload drops a packet
psp: don't encapsulate ipv6 packets with extension headers
net: don't fragment decrypted skbs
ipv4: icmp: don't quote decrypted payload in icmp errors
ipv6: icmpv6: don't quote decrypted payload in icmpv6 errors
selftests: drv-net: psp: test ipv6 tcp socket with extension headers
selftests: drv-net: psp: test that ipv4 psp packets aren't fragmented
net/mlx5e: psp: tso: replace only the length in checksum seed
.../mellanox/mlx5/core/en_accel/psp_rxtx.c | 21 +-
.../net/ethernet/mellanox/mlx5/core/en_tx.c | 8 +-
net/ipv4/icmp.c | 12 +
net/ipv4/ip_output.c | 8 +
net/ipv6/icmp.c | 16 ++
net/ipv6/ip6_output.c | 9 +
net/psp/psp_main.c | 21 +-
tools/testing/selftests/drivers/net/config | 1 +
tools/testing/selftests/drivers/net/psp.py | 249 +++++++++++++++++-
9 files changed, 327 insertions(+), 18 deletions(-)
base-commit: 8012eec76b7e6c0d9fb338fe8e3db6ca1b419da4
--
2.53.0-Meta