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.
This commit is contained in:
@@ -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);
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -4119,11 +4119,16 @@ mm_3gpp_get_ip_family_from_pdp_type (const gchar *pdp_type)
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_3gpp_normalize_ip_family (MMBearerIpFamily *family)
|
||||
mm_3gpp_normalize_ip_family (MMBearerIpFamily *family, gboolean from_user)
|
||||
{
|
||||
/* if nothing specific requested, default to IPv4 */
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user