mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net 0/2] netdevsim: fix IPsec debugfs byte order
@ 2026-09-08 14:03 Andrei Gherzan
  2026-09-08 14:03 ` [PATCH net 1/2] netdevsim: print IPsec salt/key in network " Andrei Gherzan
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Andrei Gherzan @ 2026-09-08 14:03 UTC (permalink / raw)
  To: Jakub Kicinski, Andrew Lunn, David S . Miller, Eric Dumazet,
	Paolo Abeni, Simon Horman, Shuah Khan
  Cc: netdev, linux-kernel, linux-kselftest, Kleber Sacilotto de Souza,
	Hangbin Liu, Andrei Gherzan

The netdevsim IPsec debugfs file (used by selftests/net/rtnetlink.sh's
ipsec_offload subtest) prints the SA salt and key in host CPU byte
order instead of network byte order, because nsim_sa.key[]/salt are
typed as plain u32 and printed directly with "%08x". This makes the
reported values differ between little-endian and big-endian hosts for
the same underlying key material, and breaks the selftest on
big-endian (e.g. s390x), which hardcodes the little-endian output.

A driver-side fix was proposed in 2022 but stalled in review: keeping
the fields as plain u32 meant sparse could not validate the added
ntohl()/be32_to_cpu() conversions.

  https://lore.kernel.org/netdev/20220308135106.890270-1-kleber.souza@canonical.com/

This series:

  1/2 retypes nsim_sa.key[]/salt to __be32 (matching the existing
      __be32 ipaddr[] field) and converts with be32_to_cpu() before
      printing, so the debugfs output is now network-order on every
      host, independent of endianness.

  2/2 updates the selftest's expected output to match the new,
      endianness-independent values. It depends on 1/2: applied on
      its own it would regress little-endian hosts (though it happens
      to have no effect on big-endian hosts, whose old host-order
      output already matched the new expected values).

Tested on real booted kernels, both patches applied:
  - x86_64 (little-endian): PASS: ipsec_offload
  - s390x (big-endian):     PASS: ipsec_offload

checkpatch.pl --strict and sparse (make C=2) are clean on both patches.

Andrei Gherzan (2):
  netdevsim: print IPsec salt/key in network byte order
  selftests: rtnetlink: update ipsec_offload expected output

 drivers/net/netdevsim/ipsec.c            | 10 +++++-----
 drivers/net/netdevsim/netdevsim.h        |  4 ++--
 tools/testing/selftests/net/rtnetlink.sh |  8 ++++----
 3 files changed, 11 insertions(+), 11 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-09-09 20:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-08 14:03 [PATCH net 0/2] netdevsim: fix IPsec debugfs byte order Andrei Gherzan
2026-09-08 14:03 ` [PATCH net 1/2] netdevsim: print IPsec salt/key in network " Andrei Gherzan
2026-09-08 14:03 ` [PATCH net 2/2] selftests: rtnetlink: update ipsec_offload expected output Andrei Gherzan
2026-09-09 13:37 ` [PATCH net 0/2] netdevsim: fix IPsec debugfs byte order Andrei Gherzan
2026-09-09 20:38   ` Jakub Kicinski
2026-09-09 20:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®