diff options
author | Madhav <madhavadas@google.com> | 2024-01-19 01:01:06 +0000 |
---|---|---|
committer | Madhav <madhavadas@google.com> | 2024-01-25 21:52:31 +0000 |
commit | 1655d0e014eb7019cbc51d90006d730d73a275fd (patch) | |
tree | fd378c15631722430fba104cc5c04a610e803a19 /src | |
parent | e8f1edc5c4976163a569f74cf49446bc67f88424 (diff) |
bearer-mbim: When an IP type is unspecified in the profile, default to IPv4v6 (dual-stack)
To address limitations in reading IP_TYPE information (in some cases) for profile requests,
default to IPv4v6 (dual-stack) for profile requests and IPv4 only for user requests (to ensure backward compatibility)
if nothing specific is requested. This ensures network compatibility across IPv4 and IPv6 networks,
preventing potential connectivity issues in IPv6 environments.
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-bearer-mbim.c | 4 | ||||
-rw-r--r-- | src/mm-bearer-qmi.c | 2 | ||||
-rw-r--r-- | src/mm-broadband-bearer.c | 2 | ||||
-rw-r--r-- | src/mm-iface-modem-3gpp-profile-manager.c | 2 | ||||
-rw-r--r-- | src/mm-modem-helpers.c | 13 | ||||
-rw-r--r-- | src/mm-modem-helpers.h | 3 | ||||
-rw-r--r-- | src/plugins/fibocom/mm-broadband-bearer-fibocom-ecm.c | 2 | ||||
-rw-r--r-- | src/plugins/huawei/mm-broadband-bearer-huawei.c | 2 |
8 files changed, 18 insertions, 12 deletions
diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c index 7988a080..625b988e 100644 --- a/src/mm-bearer-mbim.c +++ b/src/mm-bearer-mbim.c @@ -966,7 +966,7 @@ load_settings_from_profile (MMBearerMbim *self, MMBearerIpFamily ip_type; ip_type = mm_3gpp_profile_get_ip_type (profile); - mm_3gpp_normalize_ip_family (&ip_type); + mm_3gpp_normalize_ip_family (&ip_type, TRUE); ctx->requested_ip_type = mm_bearer_ip_family_to_mbim_context_ip_type (ip_type, &inner_error); if (inner_error) { g_propagate_error (error, inner_error); @@ -1287,7 +1287,7 @@ load_settings_from_bearer (MMBearerMbim *self, /* If we're loading settings from a profile, still read the ip-type * from the user input, as that is not stored in the profile */ ip_type = mm_bearer_properties_get_ip_type (properties); - mm_3gpp_normalize_ip_family (&ip_type); + mm_3gpp_normalize_ip_family (&ip_type, FALSE); ctx->requested_ip_type = mm_bearer_ip_family_to_mbim_context_ip_type (ip_type, &inner_error); if (inner_error) { g_propagate_error (error, inner_error); diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c index 97f9c079..f6ce94c5 100644 --- a/src/mm-bearer-qmi.c +++ b/src/mm-bearer-qmi.c @@ -1842,7 +1842,7 @@ load_ip_type_settings_from_profile (ConnectContext *ctx, MMBearerIpFamily ip_family; ip_family = mm_3gpp_profile_get_ip_type (profile); - if (mm_3gpp_normalize_ip_family (&ip_family)) + if (mm_3gpp_normalize_ip_family (&ip_family, TRUE)) ctx->no_ip_family_preference = TRUE; if (ip_family & MM_BEARER_IP_FAMILY_IPV4) ctx->ipv4 = TRUE; diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c index 3ab075e2..8b107035 100644 --- a/src/mm-broadband-bearer.c +++ b/src/mm-broadband-bearer.c @@ -125,7 +125,7 @@ detailed_connect_context_new (MMBroadbandBearer *self, ctx->secondary = (secondary ? g_object_ref (secondary) : NULL); ctx->ip_family = mm_bearer_properties_get_ip_type (mm_base_bearer_peek_config (MM_BASE_BEARER (self))); - mm_3gpp_normalize_ip_family (&ctx->ip_family); + mm_3gpp_normalize_ip_family (&ctx->ip_family, TRUE); return ctx; } diff --git a/src/mm-iface-modem-3gpp-profile-manager.c b/src/mm-iface-modem-3gpp-profile-manager.c index d4478dec..8a2ba22e 100644 --- a/src/mm-iface-modem-3gpp-profile-manager.c +++ b/src/mm-iface-modem-3gpp-profile-manager.c @@ -869,7 +869,7 @@ mm_iface_modem_3gpp_profile_manager_set_profile (MMIfaceModem3gppProfileManager /* normalize IP family right away */ ip_family = mm_3gpp_profile_get_ip_type (ctx->requested); - mm_3gpp_normalize_ip_family (&ip_family); + mm_3gpp_normalize_ip_family (&ip_family, TRUE); mm_3gpp_profile_set_ip_type (ctx->requested, ip_family); set_profile_step (task); diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index 157cb19c..44e8e71e 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -4119,11 +4119,16 @@ mm_3gpp_get_ip_family_from_pdp_type (const gchar *pdp_type) } gboolean -mm_3gpp_normalize_ip_family (MMBearerIpFamily *family) -{ - /* if nothing specific requested, default to IPv4 */ +mm_3gpp_normalize_ip_family (MMBearerIpFamily *family, gboolean from_user) +{ + /* To address limitations in reading IP_TYPE information (in some cases) for + * profile requests, default to IPv4v6 (dual-stack) for profile requests and + * IPv4 only for user requests (to ensure backward compatibility) if nothing + * specific is requested. This ensures network compatibility across IPv4 and IPv6 networks, + * preventing potential connectivity issues in IPv6 environments. + */ if (*family == MM_BEARER_IP_FAMILY_NONE || *family == MM_BEARER_IP_FAMILY_ANY) { - *family = MM_BEARER_IP_FAMILY_IPV4; + *family = from_user ? MM_BEARER_IP_FAMILY_IPV4 : MM_BEARER_IP_FAMILY_IPV4V6; return TRUE; } diff --git a/src/mm-modem-helpers.h b/src/mm-modem-helpers.h index 87199aa3..7420ba1a 100644 --- a/src/mm-modem-helpers.h +++ b/src/mm-modem-helpers.h @@ -434,7 +434,8 @@ gboolean mm_3gpp_parse_operator_id (const gchar *operator_id, const gchar *mm_3gpp_get_pdp_type_from_ip_family (MMBearerIpFamily family); MMBearerIpFamily mm_3gpp_get_ip_family_from_pdp_type (const gchar *pdp_type); -gboolean mm_3gpp_normalize_ip_family (MMBearerIpFamily *family); +gboolean mm_3gpp_normalize_ip_family (MMBearerIpFamily *family, + gboolean from_user); char *mm_3gpp_parse_iccid (const char *raw_iccid, GError **error); diff --git a/src/plugins/fibocom/mm-broadband-bearer-fibocom-ecm.c b/src/plugins/fibocom/mm-broadband-bearer-fibocom-ecm.c index bc4ee1ec..06f28b8a 100644 --- a/src/plugins/fibocom/mm-broadband-bearer-fibocom-ecm.c +++ b/src/plugins/fibocom/mm-broadband-bearer-fibocom-ecm.c @@ -272,7 +272,7 @@ connect_3gpp (MMBroadbandBearer *self, ctx->primary = g_object_ref (primary); ctx->secondary = secondary ? g_object_ref (secondary) : NULL; ctx->ip_family = mm_bearer_properties_get_ip_type (mm_base_bearer_peek_config (MM_BASE_BEARER (self))); - mm_3gpp_normalize_ip_family (&ctx->ip_family); + mm_3gpp_normalize_ip_family (&ctx->ip_family, TRUE); task = g_task_new (self, cancellable, callback, user_data); g_task_set_task_data (task, ctx, (GDestroyNotify) connect_context_free); diff --git a/src/plugins/huawei/mm-broadband-bearer-huawei.c b/src/plugins/huawei/mm-broadband-bearer-huawei.c index f166efa5..6ab65bb1 100644 --- a/src/plugins/huawei/mm-broadband-bearer-huawei.c +++ b/src/plugins/huawei/mm-broadband-bearer-huawei.c @@ -345,7 +345,7 @@ connect_3gpp_context_step (GTask *task) MMBearerIpFamily ip_family; ip_family = mm_bearer_properties_get_ip_type (mm_base_bearer_peek_config (MM_BASE_BEARER (self))); - mm_3gpp_normalize_ip_family (&ip_family); + mm_3gpp_normalize_ip_family (&ip_family, TRUE); if (ip_family != MM_BEARER_IP_FAMILY_IPV4) { g_task_return_new_error (task, MM_CORE_ERROR, |