+ sd_rtnl_message_read_u32(reply, IFLA_MTU, &mtu);
+
+ sd_network_link_get_setup_state(ifindex, &setup_state);
+ sd_network_link_get_operational_state(ifindex, &operational_state);
+
+ sd_network_link_get_dns(ifindex, &dns);
+ sd_network_link_get_ntp(ifindex, &ntp);
+
+ sprintf(devid, "n%i", ifindex);
+ d = udev_device_new_from_device_id(udev, devid);
+
+ link_get_type_string(iftype, d, &t);
+
+ if (d) {
+ driver = udev_device_get_property_value(d, "ID_NET_DRIVER");
+ path = udev_device_get_property_value(d, "ID_PATH");
+
+ vendor = udev_device_get_property_value(d, "ID_VENDOR_FROM_DATABASE");
+ if (!vendor)
+ vendor = udev_device_get_property_value(d, "ID_VENDOR");
+
+ model = udev_device_get_property_value(d, "ID_MODEL_FROM_DATABASE");
+ if (!model)
+ model = udev_device_get_property_value(d, "ID_MODEL");
+ }
+
+ if (streq_ptr(operational_state, "routable")) {
+ on_color = ansi_highlight_green();
+ off_color = ansi_highlight_off();
+ } else if (streq_ptr(operational_state, "degraded")) {
+ on_color = ansi_highlight_yellow();
+ off_color = ansi_highlight_off();
+ }
+
+ printf("%s%s%s %i: %s\n", on_color, draw_special_char(DRAW_BLACK_CIRCLE), off_color, ifindex, name);
+
+ printf(" Type: %s\n"
+ " State: %s%s%s (%s)\n",
+ strna(t),
+ on_color, strna(operational_state), off_color,
+ strna(setup_state));
+
+ if (path)
+ printf(" Path: %s\n", path);
+ if (driver)
+ printf(" Driver: %s\n", driver);
+ if (vendor)
+ printf(" Vendor: %s\n", vendor);
+ if (model)
+ printf(" Model: %s\n", model);
+
+ if (have_mac)
+ printf(" HW Address: %s\n", ether_ntoa(&e));
+
+ if (mtu > 0)
+ printf(" MTU: %u\n", mtu);
+
+ dump_addresses(rtnl, " Address: ", ifindex);
+
+ if (!strv_isempty(dns))
+ dump_list(" DNS: ", dns);
+ if (!strv_isempty(ntp))
+ dump_list(" NTP: ", ntp);
+
+ return 0;
+}
+
+static int link_status(char **args, unsigned n) {
+ _cleanup_udev_unref_ struct udev *udev = NULL;
+ _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ char **name;
+ int r;