From caf1e5d299178bb381798a7066bd35d7b2935cfa Mon Sep 17 00:00:00 2001 From: dmiller Date: Mon, 30 Jan 2023 21:45:55 +0000 Subject: [PATCH] Don't label non-Eth-like interfaces as Ethernet. See #2381 --- libdnet-stripped/src/intf-win32.c | 37 ++++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/libdnet-stripped/src/intf-win32.c b/libdnet-stripped/src/intf-win32.c index 157595aa6..245289f27 100644 --- a/libdnet-stripped/src/intf-win32.c +++ b/libdnet-stripped/src/intf-win32.c @@ -49,24 +49,29 @@ struct intf_handle { static char * _ifcombo_name(int type) { - char *name = "eth"; /* XXX */ + char *name = NULL; - if (type == IF_TYPE_ISO88025_TOKENRING) { - name = "tr"; - } else if (type == IF_TYPE_PPP) { - name = "ppp"; - } else if (type == IF_TYPE_SOFTWARE_LOOPBACK) { - name = "lo"; - } else if (type == IF_TYPE_TUNNEL) { - name = "tun"; + switch (type) { + case IF_TYPE_ETHERNET_CSMACD: + case IF_TYPE_IEEE80211: + name = "eth"; + break; + case IF_TYPE_ISO88025_TOKENRING: + name = "tr"; + break; + case IF_TYPE_PPP: + name = "ppp"; + break; + case IF_TYPE_SOFTWARE_LOOPBACK: + name = "lo"; + break; + case IF_TYPE_TUNNEL: + name = "tun"; + break; + default: + name = "unk"; + break; } - /* - IF_TYPE_OTHER - IF_TYPE_ETHERNET_CSMACD - IF_TYPE_ATM - IF_TYPE_IEEE80211 - IF_TYPE_IEEE1394 - */ return (name); }