From c519bba4ca238d1c7f83bfc506d6dfa7c9baca98 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Fri, 30 Aug 2024 15:07:22 +0800 Subject: [PATCH 1/2] mctp: Improve formatting of interface addresses 0x prefix is only added for single-byte addresses, "none" is printed instead of (no-addr). Signed-off-by: Matt Johnston --- src/mctp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mctp.c b/src/mctp.c index 0edd02b..cc717f4 100644 --- a/src/mctp.c +++ b/src/mctp.c @@ -213,12 +213,16 @@ static int display_ifinfo(struct ctx *ctx, void *p, size_t len) { updown = msg->ifi_flags & IFF_UP ? "up" : "down"; // not sure if will be NULL terminated, handle either name_len = strnlen(name, name_len); - printf("dev %*s index %d address 0x", + printf("dev %*s index %d address ", (int)name_len, name, msg->ifi_index); + if (addr_len == 1) { + // make it clear that it is hex not decimal + printf("0x"); + } if (addr && addr_len) print_hex_addr(addr, addr_len); else - printf("(no-addr)"); + printf("none"); printf(" net %d mtu %d %s\n", net, mtu, updown); return 0; } From 8245256b3cad37420abdc7a369a05ef098004982 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Mon, 21 Oct 2024 15:44:29 +0800 Subject: [PATCH 2/2] CHANGELOG: add item for address formatting improvements Signed-off-by: Jeremy Kerr --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20a20a0..290c97f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). now associated with the interface object, they no longer take the interface name as their first argument. +6. Hardware address formatting has been improved in cases where the address + size is something other than a 1-byte value. + ### Fixed 1. mctpd: EID assignments now work in the case where a new endpoint has a