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.
This commit is contained in:
Thomas Haller 2022-10-07 17:09:25 +02:00
parent 061cc60fda
commit 46fdf8a40e
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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;
}
}