mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-11-10 20:48:12 +00:00
netdevsim: print IPsec salt/key in network byte order
nsim_sa.key[] and nsim_sa.salt hold raw key material in network byte order, but are typed as plain u32 and printed with "%08x" in the debugfs read handler. This prints host-endian, so output differs between little- and big-endian hosts for the same key: little-endian: salt=0x61626364 key=0x34333231 38373635 32313039 36353433 big-endian: salt=0x64636261 key=0x31323334 35363738 39303132 33343536 This breaks selftests/net/rtnetlink.sh's ipsec_offload subtest on big-endian (e.g. s390x), which hardcodes the little-endian output. Retype key[]/salt to __be32, matching ipaddr[], and convert with be32_to_cpu() before printing. Output is now network-order on every host, independent of endianness. A similar fix was proposed in 2022 but kept the u32 typing, so sparse couldn't validate the added ntohl() calls and it stalled in review. Retyping first avoids that problem. `make C=2` on netdevsim reports the same zero warnings as before this change. Selftest update follows in the next patch. Cc: stable+noautosel@kernel.org # never worked Reported-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> Link: https://lore.kernel.org/netdev/20220308135106.890270-1-kleber.souza@canonical.com/ Signed-off-by: Andrei Gherzan <andrei.gherzan@canonical.com> Link: https://patch.msgid.link/20260908140325.13367-2-andrei.gherzan@canonical.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
3929f55da2
commit
d268403246
2 changed files with 7 additions and 7 deletions
Loading…
Add table
Add a link
Reference in a new issue