diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2020-09-07 10:46:38 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2020-09-07 18:26:43 +0000 |
commit | f8eeab21213e4ec487ce3f91b0ca09f11e52cec0 (patch) | |
tree | e94f245cc1209e21c43105e64d9c1fe9710fd324 /src/mm-bearer-mbim.c | |
parent | e52ad1cc88601b2da1946678a2743465362d88c6 (diff) |
bearer-mbim: don't fail IPv4 connection if IPv4v6 was requested
If we ask for IPv4v6 is requested but the network only grants IPv4, we
end up receiving the 'Connect Set' response with nw_error set to
'pdp-type-ipv4-only-allowed'. In this case, we should still succeed
the connection attempt and only report the IPv4 info.
We therefore change the logic to skip processing the nw_error unless
the activation state is reported as ACTIVATED or ACTIVATING.
Diffstat (limited to 'src/mm-bearer-mbim.c')
-rw-r--r-- | src/mm-bearer-mbim.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c index 57f10cb7..b80c1c99 100644 --- a/src/mm-bearer-mbim.c +++ b/src/mm-bearer-mbim.c @@ -570,6 +570,7 @@ connect_set_ready (MbimDevice *device, GError *error = NULL; MbimMessage *response; guint32 session_id; + MbimContextIpType ip_type; MbimActivationState activation_state; guint32 nw_error; @@ -587,24 +588,30 @@ connect_set_ready (MbimDevice *device, &session_id, &activation_state, NULL, /* voice_call_state */ - NULL, /* ip_type */ + &ip_type, NULL, /* context_type */ &nw_error, &inner_error)) { - if (nw_error) { - if (error) - g_error_free (error); - error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error); - } else { - /* Report the ip_type we originally requested, since the ip_type - * from the response is only relevant if the requested used - * MBIM_CONTEXT_IP_TYPE_DEFAULT, which MM never does. Some - * devices (K5160) report the wrong type in the response. - */ - mm_obj_dbg (self, "session ID '%u': %s (IP type: %s)", - session_id, - mbim_activation_state_get_string (activation_state), - mbim_context_ip_type_get_string (ctx->ip_type)); + /* Report the IP type we asked for and the one returned by the modem */ + mm_obj_dbg (self, "session ID '%u': %s (requested IP type: %s, received IP type: %s, nw error: %s)", + session_id, + mbim_activation_state_get_string (activation_state), + mbim_context_ip_type_get_string (ctx->ip_type), + mbim_context_ip_type_get_string (ip_type), + nw_error ? mbim_nw_error_get_string (nw_error) : "none"); + /* If the response reports an ACTIVATED state, we're good even if + * there is a nw_error set (e.g. asking for IPv4v6 may return a + * 'pdp-type-ipv4-only-allowed' nw_error). */ + if (activation_state != MBIM_ACTIVATION_STATE_ACTIVATED && + activation_state != MBIM_ACTIVATION_STATE_ACTIVATING) { + if (nw_error) { + g_clear_error (&error); + error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error); + } else if (!error) { + error = g_error_new (MM_MOBILE_EQUIPMENT_ERROR, + MM_MOBILE_EQUIPMENT_ERROR_GPRS_UNKNOWN, + "Unknown error: context activation failed"); + } } } else { /* Prefer the error from the result to the parsing error */ |