summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-10-07 17:09:25 +0200
committerThomas Haller <thaller@redhat.com>2022-10-11 14:27:18 +0200
commit46fdf8a40e951766840b55f1d6d37cc5d373e278 (patch)
treefa5c2cbc7436a1e6d4aac5b407a7ce6d1b6f888f
parent061cc60fda5a8f231178969af3b4c847fea997c6 (diff)
downloadNetworkManager-46fdf8a40e951766840b55f1d6d37cc5d373e278.tar.gz
platform: in _linktype_get_type() check for devtype before the interface name
I think the devtype should be checked first, before the interface name. Checking by name seems really very hacky, move that last.
-rw-r--r--src/libnm-platform/nm-linux-platform.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c
index 8719eca494..2fdef42ad6 100644
--- a/src/libnm-platform/nm-linux-platform.c
+++ b/src/libnm-platform/nm-linux-platform.c
@@ -1285,6 +1285,17 @@ _linktype_get_type(NMPlatform *platform,
return NM_LINK_TYPE_WIFI;
}
+ if (arptype == ARPHRD_ETHER) {
+ /* The USB gadget interfaces behave and look like ordinary ethernet devices
+ * aside from the DEVTYPE. */
+ if (nm_streq0(devtype, "gadget"))
+ return NM_LINK_TYPE_ETHERNET;
+
+ /* Distributed Switch Architecture switch chips */
+ if (nm_streq0(devtype, "dsa"))
+ return NM_LINK_TYPE_ETHERNET;
+ }
+
/* Misc non-upstream WWAN drivers. rmnet is Qualcomm's proprietary
* modem interface, ccmni is MediaTek's. FIXME: these drivers should
* really set devtype=WWAN.
@@ -1312,15 +1323,6 @@ _linktype_get_type(NMPlatform *platform,
*/
if (!kind && !devtype)
return NM_LINK_TYPE_ETHERNET;
-
- /* The USB gadget interfaces behave and look like ordinary ethernet devices
- * aside from the DEVTYPE. */
- if (nm_streq0(devtype, "gadget"))
- return NM_LINK_TYPE_ETHERNET;
-
- /* Distributed Switch Architecture switch chips */
- if (nm_streq0(devtype, "dsa"))
- return NM_LINK_TYPE_ETHERNET;
}
}