]> git.ipfire.org Git - thirdparty/iproute2.git/commit
add print_hexstring helper main
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 23 Jul 2026 18:38:59 +0000 (18:38 +0000)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 27 Jul 2026 18:10:27 +0000 (11:10 -0700)
commit5696fee4c69fe3cc12e8cc821630633f616db8e2
tree3d3124c135d4381bb6dc29f24a54711bcceb0256
parentee2a4a86625688d8c2b468ec15d7ae35a4f5717f
add print_hexstring helper

hexstring_n2a() writes into a caller-supplied buffer and silently
truncates when it is too small: the loop stops once fewer than three
bytes remain and returns the partial string. Callers using a fixed
SPRINT_BUF therefore drop trailing bytes for keys wider than 31 bytes.

Add a new function print_hexstring() that formats and prints a binary
attribute in one call.

Convert the callers that dump a binary attribute straight to output
over to print_hexstring().

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reported-by: Gris Ge <cnfourt@gmail.com>
include/json_print.h
ip/ipaddress.c
ip/ipmacsec.c
lib/bpf_legacy.c
lib/json_print.c
tc/f_bpf.c
tc/m_action.c
tc/m_bpf.c