aboutsummaryrefslogtreecommitdiff
path: root/src/mm-modem-helpers-mbim.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2023-02-17 14:18:16 +0000
committerAleksander Morgado <aleksandermj@chromium.org>2023-02-20 11:07:38 +0000
commit6d1f4aee305a6ebeae7bec8b745de33d5368371d (patch)
treeb608fed991d2b5feae23d83e2f7e94dc1288029d /src/mm-modem-helpers-mbim.c
parent278678d8ed818a778377dcb57f5611b04c631450 (diff)
broadband-modem-mbim: limit the use of context types defined in MBIMEx
The Tethering context type UUID was defined by Microsoft in its extensions as `5e4e0601-48dc-4e2b-acb8-08b4016bbaac` (along with others like Admin, Xcap, App and EmergencyCalling), see https://learn.microsoft.com/en-us/windows-hardware/drivers/network/mb-provisioned-context-operations. These UUIDs are expected to be usable only if the modem supports `MBIM_CID_MS_PROVISIONED_CONTEXT_V2` (CID=1) in the Basic Connect Extensions service (3d01dcc5-fef5-4d05-0d3abef7058e9aaf). If the modem doesn't support these, we should try to fallback to a more generic APN type automatically, e.g. "Internet", which was defined in MBIM 1.0 and should always be supported. There should be no problem in a modem to have 2 separate PDN connections with the same context type.
Diffstat (limited to 'src/mm-modem-helpers-mbim.c')
-rw-r--r--src/mm-modem-helpers-mbim.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/mm-modem-helpers-mbim.c b/src/mm-modem-helpers-mbim.c
index 223f9e62..7db91e5c 100644
--- a/src/mm-modem-helpers-mbim.c
+++ b/src/mm-modem-helpers-mbim.c
@@ -562,6 +562,7 @@ mm_bearer_apn_type_from_mbim_context_type (MbimContextType context_type)
MbimContextType
mm_bearer_apn_type_to_mbim_context_type (MMBearerApnType apn_type,
+ gboolean mbim_extensions_supported,
gpointer log_object,
GError **error)
{
@@ -580,8 +581,6 @@ mm_bearer_apn_type_to_mbim_context_type (MMBearerApnType apn_type,
return MBIM_CONTEXT_TYPE_IMS;
if (apn_type & MM_BEARER_APN_TYPE_MMS)
return MBIM_CONTEXT_TYPE_MMS;
- if (apn_type &MM_BEARER_APN_TYPE_MANAGEMENT)
- return MBIM_CONTEXT_TYPE_ADMIN;
if (apn_type & MM_BEARER_APN_TYPE_VOICE)
return MBIM_CONTEXT_TYPE_VOICE;
if (apn_type & MM_BEARER_APN_TYPE_PRIVATE)
@@ -592,14 +591,30 @@ mm_bearer_apn_type_to_mbim_context_type (MMBearerApnType apn_type,
return MBIM_CONTEXT_TYPE_VIDEO_SHARE;
if (apn_type & MM_BEARER_APN_TYPE_LOCAL)
return MBIM_CONTEXT_TYPE_LOCAL;
- if (apn_type & MM_BEARER_APN_TYPE_APP)
- return MBIM_CONTEXT_TYPE_APP;
- if (apn_type & MM_BEARER_APN_TYPE_XCAP)
- return MBIM_CONTEXT_TYPE_XCAP;
- if (apn_type & MM_BEARER_APN_TYPE_TETHERING)
- return MBIM_CONTEXT_TYPE_TETHERING;
- if (apn_type & MM_BEARER_APN_TYPE_EMERGENCY)
- return MBIM_CONTEXT_TYPE_EMERGENCY_CALLING;
+
+ if (mbim_extensions_supported) {
+ if (apn_type & MM_BEARER_APN_TYPE_MANAGEMENT)
+ return MBIM_CONTEXT_TYPE_ADMIN;
+ if (apn_type & MM_BEARER_APN_TYPE_APP)
+ return MBIM_CONTEXT_TYPE_APP;
+ if (apn_type & MM_BEARER_APN_TYPE_XCAP)
+ return MBIM_CONTEXT_TYPE_XCAP;
+ if (apn_type & MM_BEARER_APN_TYPE_TETHERING)
+ return MBIM_CONTEXT_TYPE_TETHERING;
+ if (apn_type & MM_BEARER_APN_TYPE_EMERGENCY)
+ return MBIM_CONTEXT_TYPE_EMERGENCY_CALLING;
+ } else {
+ if ((apn_type & MM_BEARER_APN_TYPE_MANAGEMENT) ||
+ (apn_type & MM_BEARER_APN_TYPE_APP) ||
+ (apn_type & MM_BEARER_APN_TYPE_XCAP) ||
+ (apn_type & MM_BEARER_APN_TYPE_TETHERING) ||
+ (apn_type & MM_BEARER_APN_TYPE_EMERGENCY)) {
+ mm_obj_dbg (log_object,
+ "MS extensions unsupported: "
+ "fallback to using default (internet) APN type");
+ return MBIM_CONTEXT_TYPE_INTERNET;
+ }
+ }
str = mm_bearer_apn_type_build_string_from_mask (apn_type);
g_set_error (error,