* [PATCH iproute2-next] ipaddress.c: do not show address priority in brief mode
@ 2026-05-05 19:36 Arseny Maslennikov
0 siblings, 0 replies; only message in thread
From: Arseny Maslennikov @ 2026-05-05 19:36 UTC (permalink / raw)
To: netdev; +Cc: Arseny Maslennikov
Otherwise, the following output is possible:
% ip -br a
lo UNKNOWN 127.0.0.1/8 ::1/128
enp7s0 UP 10.5.0.9/16 metric 1024 fe80::546f:33ff:fee1:9/64 2001:db8:0:a:546f:33ff:fee1:9/64
This was observed on a machine with systemd-networkd stable 258.5 active.
The point of `ip -brief a` is to provide basic information about addresses
easily processed by awk(1) and the like. Consumers of its output have come
to expect $3 and further fields to be a space-separated list of addresses.
The above output breaks this expectation. While a human reader may
distinguish "metric" and "1024" from an address/prefixlen pair, existing
scripts won't.
Fixes: 78d04c7b27cf ("ipaddress: Add support for address metric")
Signed-off-by: Arseny Maslennikov <ar@cs.msu.ru>
---
ip/ipaddress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 4d93a04a..80070a1a 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1636,7 +1636,7 @@ int print_addrinfo(struct nlmsghdr *n, void *arg)
}
print_int(PRINT_ANY, "prefixlen", "/%d ", ifa->ifa_prefixlen);
- if (rta_tb[IFA_RT_PRIORITY])
+ if (!brief && rta_tb[IFA_RT_PRIORITY])
print_uint(PRINT_ANY, "metric", "metric %u ",
rta_getattr_u32(rta_tb[IFA_RT_PRIORITY]));
}
--
2.50.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-06 14:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 19:36 [PATCH iproute2-next] ipaddress.c: do not show address priority in brief mode Arseny Maslennikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox