aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mm-bearer-mbim.c40
-rw-r--r--src/mm-bearer-qmi.c41
-rw-r--r--src/mm-broadband-bearer.c31
-rw-r--r--src/mm-iface-modem-simple.c6
-rw-r--r--src/mm-modem-helpers.c4
5 files changed, 81 insertions, 41 deletions
diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c
index a26ef4d8..8b64a4c0 100644
--- a/src/mm-bearer-mbim.c
+++ b/src/mm-bearer-mbim.c
@@ -661,27 +661,41 @@ connect_context_step (ConnectContext *ctx)
}
ip_family = mm_bearer_properties_get_ip_type (ctx->properties);
- if (ip_family == MM_BEARER_IP_FAMILY_UNKNOWN) {
+ if (ip_family == MM_BEARER_IP_FAMILY_NONE ||
+ ip_family == MM_BEARER_IP_FAMILY_ANY) {
+ gchar * str;
+
ip_family = mm_bearer_get_default_ip_family (MM_BEARER (ctx->self));
- mm_dbg ("No specific IP family requested, defaulting to %s",
- mm_bearer_ip_family_get_string (ip_family));
+ str = mm_bearer_ip_family_build_string_from_mask (ip_family);
+ mm_dbg ("No specific IP family requested, defaulting to %s", str);
+ g_free (str);
}
- switch (ip_family) {
- case MM_BEARER_IP_FAMILY_IPV4:
+ if (ip_family == MM_BEARER_IP_FAMILY_IPV4)
ip_type = MBIM_CONTEXT_IP_TYPE_IPV4;
- break;
- case MM_BEARER_IP_FAMILY_IPV6:
+ else if (ip_family == MM_BEARER_IP_FAMILY_IPV6)
ip_type = MBIM_CONTEXT_IP_TYPE_IPV6;
- break;
- case MM_BEARER_IP_FAMILY_IPV4V6:
+ else if (ip_family == MM_BEARER_IP_FAMILY_IPV4V6)
ip_type = MBIM_CONTEXT_IP_TYPE_IPV4V6;
- break;
- case MM_BEARER_IP_FAMILY_UNKNOWN:
- default:
+ else if (ip_family == (MM_BEARER_IP_FAMILY_IPV4 | MM_BEARER_IP_FAMILY_IPV6))
+ ip_type = MBIM_CONTEXT_IP_TYPE_IPV4_AND_IPV6;
+ else if (ip_family == MM_BEARER_IP_FAMILY_NONE ||
+ ip_family == MM_BEARER_IP_FAMILY_ANY)
/* A valid default IP family should have been specified */
g_assert_not_reached ();
- break;
+ else {
+ gchar * str;
+
+ str = mm_bearer_ip_family_build_string_from_mask (ip_family);
+ g_simple_async_result_set_error (
+ ctx->result,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_UNSUPPORTED,
+ "Unsupported IP type configuration: '%s'",
+ str);
+ g_free (str);
+ connect_context_complete_and_free (ctx);
+ return;
}
mm_dbg ("Launching connection with APN '%s'...", apn);
diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c
index bc97ec97..a72fa48e 100644
--- a/src/mm-bearer-qmi.c
+++ b/src/mm-bearer-qmi.c
@@ -884,31 +884,40 @@ _connect (MMBearer *self,
ctx->password = g_strdup (mm_bearer_properties_get_password (properties));
ip_family = mm_bearer_properties_get_ip_type (properties);
- if (ip_family == MM_BEARER_IP_FAMILY_UNKNOWN) {
+ if (ip_family == MM_BEARER_IP_FAMILY_NONE ||
+ ip_family == MM_BEARER_IP_FAMILY_ANY) {
+ gchar *ip_family_str;
+
ip_family = mm_bearer_get_default_ip_family (self);
+ ip_family_str = mm_bearer_ip_family_build_string_from_mask (ip_family);
mm_dbg ("No specific IP family requested, defaulting to %s",
- mm_bearer_ip_family_get_string (ip_family));
+ ip_family_str);
ctx->no_ip_family_preference = TRUE;
+ g_free (ip_family_str);
}
- switch (ip_family) {
- case MM_BEARER_IP_FAMILY_IPV4:
+ if (ip_family & MM_BEARER_IP_FAMILY_IPV4)
ctx->ipv4 = TRUE;
- ctx->ipv6 = FALSE;
- break;
- case MM_BEARER_IP_FAMILY_IPV6:
- ctx->ipv4 = FALSE;
+ if (ip_family & MM_BEARER_IP_FAMILY_IPV6)
ctx->ipv6 = TRUE;
- break;
- case MM_BEARER_IP_FAMILY_IPV4V6:
+ if (ip_family & MM_BEARER_IP_FAMILY_IPV4V6) {
ctx->ipv4 = TRUE;
ctx->ipv6 = TRUE;
- break;
- case MM_BEARER_IP_FAMILY_UNKNOWN:
- default:
- /* A valid default IP family should have been specified */
- g_assert_not_reached ();
- break;
+ }
+
+ if (!ctx->ipv4 && !ctx->ipv6) {
+ gchar *str;
+
+ str = mm_bearer_ip_family_build_string_from_mask (ip_family);
+ g_simple_async_result_set_error (
+ ctx->result,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_UNSUPPORTED,
+ "Unsupported IP type requested: '%s'",
+ str);
+ g_free (str);
+ connect_context_complete_and_free (ctx);
+ return;
}
auth = mm_bearer_properties_get_allowed_auth (properties);
diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c
index 09dd1871..9a891e74 100644
--- a/src/mm-broadband-bearer.c
+++ b/src/mm-broadband-bearer.c
@@ -168,10 +168,14 @@ detailed_connect_context_new (MMBroadbandBearer *self,
detailed_connect_context_new);
ctx->ip_family = mm_bearer_properties_get_ip_type (mm_bearer_peek_config (MM_BEARER (self)));
- if (ctx->ip_family == MM_BEARER_IP_FAMILY_UNKNOWN) {
+ if (ctx->ip_family == MM_BEARER_IP_FAMILY_NONE ||
+ ctx->ip_family == MM_BEARER_IP_FAMILY_ANY) {
+ gchar *default_family;
+
ctx->ip_family = mm_bearer_get_default_ip_family (MM_BEARER (self));
- mm_dbg ("No specific IP family requested, defaulting to %s",
- mm_bearer_ip_family_get_string (ctx->ip_family));
+ default_family = mm_bearer_ip_family_build_string_from_mask (ctx->ip_family);
+ mm_dbg ("No specific IP family requested, defaulting to %s", default_family);
+ g_free (default_family);
}
/* NOTE:
@@ -789,10 +793,15 @@ find_cid_ready (MMBaseModem *modem,
pdp_type = mm_3gpp_get_pdp_type_from_ip_family (ctx->ip_family);
if (!pdp_type) {
+ gchar * str;
+
+ str = mm_bearer_ip_family_build_string_from_mask (ctx->ip_family);
g_simple_async_result_set_error (ctx->result,
MM_CORE_ERROR,
MM_CORE_ERROR_INVALID_ARGS,
- "Invalid PDP type requested");
+ "Unsupported IP type requested: '%s'",
+ str);
+ g_free (str);
detailed_connect_context_complete_and_free (ctx);
return;
}
@@ -952,11 +961,14 @@ parse_pdp_list (MMBaseModem *modem,
mm_dbg ("Found '%u' PDP contexts", g_list_length (pdp_list));
for (l = pdp_list; l; l = g_list_next (l)) {
MM3gppPdpContext *pdp = l->data;
+ gchar *ip_family_str;
+ ip_family_str = mm_bearer_ip_family_build_string_from_mask (pdp->pdp_type);
mm_dbg (" PDP context [cid=%u] [type='%s'] [apn='%s']",
pdp->cid,
- mm_bearer_ip_family_get_string (pdp->pdp_type),
+ ip_family_str,
pdp->apn ? pdp->apn : "");
+ g_free (ip_family_str);
}
/* Look for the exact PDP context we want */
@@ -973,13 +985,16 @@ parse_pdp_list (MMBaseModem *modem,
const gchar *apn;
apn = mm_bearer_properties_get_apn (mm_bearer_peek_config (MM_BEARER (ctx->self)));
- if (apn &&
- g_str_equal (pdp->apn, apn)) {
+ if (apn && g_str_equal (pdp->apn, apn)) {
+ gchar *ip_family_str;
+
/* Found a PDP context with the same CID and PDP type, we'll use it. */
+ ip_family_str = mm_bearer_ip_family_build_string_from_mask (pdp->pdp_type);
mm_dbg ("Found PDP context with CID %u and PDP type %s for APN '%s'",
- pdp->cid, mm_bearer_ip_family_get_string (pdp->pdp_type), pdp->apn);
+ pdp->cid, ip_family_str, pdp->apn);
cid = pdp->cid;
ctx->use_existing_cid = TRUE;
+ g_free (ip_family_str);
/* In this case, stop searching */
break;
}
diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c
index d29b9c05..773d091d 100644
--- a/src/mm-iface-modem-simple.c
+++ b/src/mm-iface-modem-simple.c
@@ -818,8 +818,10 @@ connect_auth_ready (MMBaseModem *self,
mm_dbg (" APN: %s", VALIDATE_UNSPECIFIED (mm_simple_connect_properties_get_apn (ctx->properties)));
ip_family = mm_simple_connect_properties_get_ip_type (ctx->properties);
- if (ip_family != MM_BEARER_IP_FAMILY_UNKNOWN) {
- mm_dbg (" IP family: %s", mm_bearer_ip_family_get_string (ip_family));
+ if (ip_family != MM_BEARER_IP_FAMILY_NONE) {
+ str = mm_bearer_ip_family_build_string_from_mask (ip_family);
+ mm_dbg (" IP family: %s", str);
+ g_free (str);
} else
mm_dbg (" IP family: %s", VALIDATE_UNSPECIFIED (NULL));
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index 4bffd11b..c4640d42 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -691,7 +691,7 @@ mm_3gpp_parse_cgdcont_read_response (const gchar *reply,
str = mm_get_string_unquoted_from_match_info (match_info, 2);
ip_family = mm_3gpp_get_ip_family_from_pdp_type (str);
- if (ip_family == MM_BEARER_IP_FAMILY_UNKNOWN)
+ if (ip_family == MM_BEARER_IP_FAMILY_NONE)
mm_dbg ("Ignoring PDP context type: '%s'", str);
else {
MM3gppPdpContext *pdp;
@@ -1711,7 +1711,7 @@ mm_3gpp_get_ip_family_from_pdp_type (const gchar *pdp_type)
return MM_BEARER_IP_FAMILY_IPV6;
if (g_str_equal (pdp_type, "IPV4V6"))
return MM_BEARER_IP_FAMILY_IPV4V6;
- return MM_BEARER_IP_FAMILY_UNKNOWN;
+ return MM_BEARER_IP_FAMILY_NONE;
}
/*************************************************************************/