+ sd_rtnl_message_read_u32(reply, IFLA_MTU, &mtu);
+
+ sd_network_link_get_operational_state(ifindex, &operational_state);
+ operational_state_to_color(operational_state, &on_color_operational, &off_color_operational);
+
+ sd_network_link_get_setup_state(ifindex, &setup_state);
+ setup_state_to_color(setup_state, &on_color_setup, &off_color_setup);
+
+ sd_network_link_get_dns(ifindex, &dns);
+ sd_network_link_get_ntp(ifindex, &ntp);
+ sd_network_link_get_domains(ifindex, &domains);
+ r = sd_network_link_get_wildcard_domain(ifindex);
+ if (r > 0) {
+ char *wildcard;
+
+ wildcard = strdup("*");
+ if (!wildcard)
+ return log_oom();
+
+ if (strv_consume(&domains, wildcard) < 0)
+ return log_oom();
+ }
+
+ sprintf(devid, "n%i", ifindex);
+ d = udev_device_new_from_device_id(udev, devid);
+
+ link_get_type_string(iftype, d, &t);
+
+ if (d) {
+ link = udev_device_get_property_value(d, "ID_NET_LINK_FILE");
+ 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");
+ }
+
+ sd_network_link_get_network_file(ifindex, &network);
+
+ printf("%s%s%s %i: %s\n", on_color_operational, draw_special_char(DRAW_BLACK_CIRCLE), off_color_operational, ifindex, name);
+
+ printf(" Link File: %s\n"
+ "Network File: %s\n"
+ " Type: %s\n"
+ " State: %s%s%s (%s%s%s)\n",
+ strna(link),
+ strna(network),
+ strna(t),
+ on_color_operational, strna(operational_state), off_color_operational,
+ on_color_setup, strna(setup_state), off_color_setup);
+
+ 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) {
+ char ea[ETHER_ADDR_TO_STRING_MAX];
+ printf(" HW Address: %s\n", ether_addr_to_string(&e, ea));
+ }
+
+ if (mtu > 0)
+ printf(" MTU: %u\n", mtu);
+
+ dump_addresses(rtnl, " Address: ", ifindex);
+
+ if (!strv_isempty(dns))
+ dump_list(" DNS: ", dns);
+ if (!strv_isempty(domains))
+ dump_list(" Domain: ", domains);
+ 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;