summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRatchanan Srirattanamet <ratchanan@ubports.com>2022-09-22 02:23:17 +0700
committerThomas Haller <thaller@redhat.com>2022-10-11 14:27:18 +0200
commit061cc60fda5a8f231178969af3b4c847fea997c6 (patch)
treeaaa130b113435e15647e525fcbac1b2b067ac584
parent48dbd02d087f3b3e5f9a79ddba8d16f820ed7046 (diff)
platform: also recognize rmnet/ccmni with ARPHRD_RAWIP type
Turns out, modern rmnet_* devices doesn't use ARPHRD_ETHER arptype, but ARPHRD_RAWIP. Also complicating the fact is that ARPHRD_RAWIP is actually added in v4.14, but devices using kernel before that version define this value as "530" in an out-of-tree patch [1]. Recognize this case and check explicitly for 3 values of arptype. [1] https://github.com/LineageOS/android_kernel_google_msm-4.9/commit/54948008c293fdf48552a5c39c91c09c3eb76ed2 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1392
-rw-r--r--src/libnm-platform/nm-linux-platform.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c
index 90c05f7ba0..8719eca494 100644
--- a/src/libnm-platform/nm-linux-platform.c
+++ b/src/libnm-platform/nm-linux-platform.c
@@ -1285,15 +1285,26 @@ _linktype_get_type(NMPlatform *platform,
return NM_LINK_TYPE_WIFI;
}
- if (arptype == ARPHRD_ETHER) {
- /* Misc non-upstream WWAN drivers. rmnet is Qualcomm's proprietary
- * modem interface, ccmni is MediaTek's. FIXME: these drivers should
- * really set devtype=WWAN.
- */
+ /* Misc non-upstream WWAN drivers. rmnet is Qualcomm's proprietary
+ * modem interface, ccmni is MediaTek's. FIXME: these drivers should
+ * really set devtype=WWAN.
+ *
+ * Value "530" is the out-of-tree version of ARPHRD_RAWIP before it's
+ * merged in Linux 4.14. For the mainline version, this has the value
+ * of "519".
+ *
+ * [1] https://github.com/LineageOS/android_kernel_google_msm-4.9/commit/54948008c293fdf48552a5c39c91c09c3eb76ed2
+ */
+ if (NM_IN_SET(arptype,
+ ARPHRD_ETHER,
+ 519 /* ARPHRD_RAWIP */,
+ 530 /* out-of-tree ARPHRD_RAWIP */)) {
if (g_str_has_prefix(ifname, "rmnet") || g_str_has_prefix(ifname, "rev_rmnet")
|| g_str_has_prefix(ifname, "ccmni"))
return NM_LINK_TYPE_WWAN_NET;
+ }
+ if (arptype == ARPHRD_ETHER) {
/* Standard wired ethernet interfaces don't report an rtnl_link_type, so
* only allow fallback to Ethernet if no type is given. This should
* prevent future virtual network drivers from being treated as Ethernet