[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b924dfca0572f87df953743e1ea26270eb251672.1576443050.git.mkubecek@suse.cz>
Date: Sun, 15 Dec 2019 22:06:10 +0100 (CET)
From: Michal Kubecek <mkubecek@...e.cz>
To: David Ahern <dsahern@...il.com>
Cc: Stephen Hemminger <stephen@...workplumber.org>,
netdev@...r.kernel.org
Subject: [PATCH iproute2-next 2/2] ip link: show permanent hardware address
Display permanent hardware address of an interface in output of
"ip link show" and "ip addr show". To reduce noise, permanent address is
only shown if it is different from current one.
Signed-off-by: Michal Kubecek <mkubecek@...e.cz>
---
ip/ipaddress.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 964f14df93f0..9415d7682c12 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1011,6 +1011,24 @@ int print_linkinfo(struct nlmsghdr *n, void *arg)
ifi->ifi_type,
b1, sizeof(b1)));
}
+ if (tb[IFLA_PERM_ADDRESS]) {
+ unsigned int len = RTA_PAYLOAD(tb[IFLA_PERM_ADDRESS]);
+
+ if (!tb[IFLA_ADDRESS] ||
+ RTA_PAYLOAD(tb[IFLA_ADDRESS]) != len ||
+ memcmp(RTA_DATA(tb[IFLA_PERM_ADDRESS]),
+ RTA_DATA(tb[IFLA_ADDRESS]), len)) {
+ print_string(PRINT_FP, NULL, " permaddr ", NULL);
+ print_color_string(PRINT_ANY,
+ COLOR_MAC,
+ "permaddr",
+ "%s",
+ ll_addr_n2a(RTA_DATA(tb[IFLA_PERM_ADDRESS]),
+ RTA_PAYLOAD(tb[IFLA_PERM_ADDRESS]),
+ ifi->ifi_type,
+ b1, sizeof(b1)));
+ }
+ }
}
if (tb[IFLA_LINK_NETNSID]) {
--
2.24.1
Powered by blists - more mailing lists