linux/drivers/net/netdevsim
Hangbin Liu 30472935f7 netdevsim: print human readable IP address
commit c71bc6da61 upstream.

Currently, IPSec addresses are printed in hexadecimal format, which is
not user-friendly. e.g.

  # cat /sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec
  SA count=2 tx=20
  sa[0] rx ipaddr=0x00000000 00000000 00000000 0100a8c0
  sa[0]    spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1
  sa[0]    key=0x3167608a ca4f1397 43565909 941fa627
  sa[1] tx ipaddr=0x00000000 00000000 00000000 00000000
  sa[1]    spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1
  sa[1]    key=0x3167608a ca4f1397 43565909 941fa627

This patch updates the code to print the IPSec address in a human-readable
format for easier debug. e.g.

 # cat /sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec
 SA count=4 tx=40
 sa[0] tx ipaddr=0.0.0.0
 sa[0]    spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1
 sa[0]    key=0x3167608a ca4f1397 43565909 941fa627
 sa[1] rx ipaddr=192.168.0.1
 sa[1]    spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1
 sa[1]    key=0x3167608a ca4f1397 43565909 941fa627
 sa[2] tx ipaddr=::
 sa[2]    spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1
 sa[2]    key=0x3167608a ca4f1397 43565909 941fa627
 sa[3] rx ipaddr=2000::1
 sa[3]    spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1
 sa[3]    key=0x3167608a ca4f1397 43565909 941fa627

Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://patch.msgid.link/20241010040027.21440-2-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-02-21 13:57:25 +01:00
..
bpf.c netdevsim: Don't accept device bound programs 2023-12-08 08:52:21 +01:00
bus.c driver core: bus: mark the struct bus_type for sysfs callbacks as constant 2023-03-23 13:20:40 +01:00
dev.c netdevsim: use cond_resched() in nsim_dev_trap_report_work() 2024-11-01 01:58:22 +01:00
ethtool.c net: netdevsim: use mock PHC driver 2023-08-09 15:59:21 -07:00
fib.c netdevsim: Add trailing zero to terminate the string in nsim_nexthop_bucket_activity_write() 2024-11-08 16:28:18 +01:00
health.c netdevsim: prevent bad user input in nsim_dev_health_break_write() 2024-12-27 13:58:48 +01:00
hwstats.c netdevsim: Fix hwstats debugfs file permissions 2022-09-19 14:40:38 -07:00
ipsec.c netdevsim: print human readable IP address 2025-02-21 13:57:25 +01:00
macsec.c netdevsim: add dummy macsec offload 2023-07-14 09:16:53 +01:00
Makefile netdevsim: add dummy macsec offload 2023-07-14 09:16:53 +01:00
netdev.c net: netdevsim: don't try to destroy PHC on VFs 2024-01-25 15:35:59 -08:00
netdevsim.h net: netdevsim: try to close UDP port harness races 2025-02-08 09:52:30 +01:00
psample.c netdevsim: Only use sampling truncation length when valid 2021-04-22 13:23:56 -07:00
udp_tunnels.c net: netdevsim: try to close UDP port harness races 2025-02-08 09:52:30 +01:00