DORMANTno replies

[PATCH iproute2-next] Fix netdevsim switch_id display truncation

From: Gris Ge <hidden>
Date: 2026-07-12 03:46:01
Subsystem: the rest · Maintainer: Linus Torvalds

Problem:

The `ip -d link show sim0` against of netdevsim interface, the
`switchid` only has 62 chars. The kernel `struct netdev_phys_item_id`
confirmed the switch id is 32 bytes which should produces 64 hex chars.

Root cause:

When `print_linkinfo()` showing `switchid`, it invokes `hexstring_n2a()`
which output hex string to `SPRINT_BUF(b1)` including trailing NULL.
The 32 bytes binary need 65 chars including trailing NULL while
`SPRINT_BUF` is 64 chars.

Fix:

Bump `SPRINT_BSIZE` from 64 to 128.

Signed-off-by: Gris Ge <redacted>
---
 include/utils.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/utils.h b/include/utils.h
index f0d45bad..c451baa9 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -39,7 +39,7 @@ extern bool do_all;
 extern int echo_request;
 extern int use_iec;
 
-#define SPRINT_BSIZE 64
+#define SPRINT_BSIZE 128
 #define SPRINT_BUF(x)	char x[SPRINT_BSIZE]
 
 void incomplete_command(void) __attribute__((noreturn));
-- 
2.55.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help