networkd: display wireguard devtype

It's not useful to simply show "none", when we have more interesting
information to display.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld
2018-01-29 20:58:30 +01:00
parent 302af1c250
commit a18461bc7d
+16 -8
View File
@@ -62,18 +62,26 @@ static int link_get_type_string(unsigned short iftype, sd_device *d, char **ret)
assert(ret);
if (iftype == ARPHRD_ETHER && d) {
if (d) {
const char *devtype = NULL, *id = NULL;
/* WLANs have iftype ARPHRD_ETHER, but we want
* to show a more useful type string for
* them */
(void) sd_device_get_devtype(d, &devtype);
if (streq_ptr(devtype, "wlan"))
id = "wlan";
else if (streq_ptr(devtype, "wwan"))
id = "wwan";
/* WLANs have iftype ARPHRD_ETHER, but we want
* to show a more useful type string for
* them */
if (iftype == ARPHRD_ETHER) {
if (streq_ptr(devtype, "wlan"))
id = "wlan";
else if (streq_ptr(devtype, "wwan"))
id = "wwan";
}
/* Likewise, WireGuard has iftype ARPHRD_NONE,
* since it's layer 3, but we of course want
* something more useful than that. */
if (iftype == ARPHRD_NONE && streq_ptr(devtype, "wireguard"))
id = "wireguard";
if (id) {
p = strdup(id);