summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-12 18:50:06 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-12 18:56:35 +0100
commit888943fc6246b2917168fff59380b58b678ba157 (patch)
tree05457ecde327d19e027d0194ab24b2dac283034d /src
parent4b7c1d5d6a006088910bac42ab3b777be9cf3cc1 (diff)
networkctl: show MAC address OUI vendor next to MAC addresses
Diffstat (limited to 'src')
-rw-r--r--src/network/networkctl.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index 815ea1698d..b3c5a6c2ca 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -254,6 +254,9 @@ static int ieee_oui(struct udev_hwdb *hwdb, struct ether_addr *mac, char **ret)
char *description;
char str[strlen("OUI:XXYYXXYYXXYY") + 1];
+ if (!hwdb)
+ return -EINVAL;
+
/* skip commonly misused 00:00:00 (Xerox) prefix */
if (memcmp(mac, "\0\0\0", 3) == 0)
return -EINVAL;
@@ -574,19 +577,25 @@ static int link_status_one(sd_rtnl *rtnl, struct udev *udev, const char *name) {
if (model)
printf(" Model: %s\n", model);
+ hwdb = udev_hwdb_new(udev);
+
if (have_mac) {
+ _cleanup_free_ char *description = NULL;
char ea[ETHER_ADDR_TO_STRING_MAX];
- printf(" HW Address: %s\n", ether_addr_to_string(&e, ea));
+
+ ieee_oui(hwdb, &e, &description);
+
+ if (description)
+ printf(" HW Address: %s (%s)\n", ether_addr_to_string(&e, ea), description);
+ else
+ printf(" HW Address: %s\n", ether_addr_to_string(&e, ea));
}
if (mtu > 0)
printf(" MTU: %u\n", mtu);
- hwdb = udev_hwdb_new(udev);
-
- dump_gateways(rtnl, hwdb, " Gateway: ", ifindex);
-
dump_addresses(rtnl, " Address: ", ifindex);
+ dump_gateways(rtnl, hwdb, " Gateway: ", ifindex);
if (!strv_isempty(dns))
dump_list(" DNS: ", dns);