diff options
author | Aleksander Morgado <aleksandermj@chromium.org> | 2023-10-26 12:24:10 +0000 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2023-10-27 11:34:26 +0200 |
commit | 10b8ee4cb9829e311a2e9be4e8516af2ac869632 (patch) | |
tree | f4cc0bb2f4be7336ebeb5cda0971be5b34e3c5a9 /src | |
parent | d0f97a4c62ccab064ea305d3367ac4c020a39f78 (diff) |
modem-helpers-qmi: avoid "ip-version-mismatch" error if possible
Based on the WDS client being connected, we'll convert this error into
"IPv4 only allowed" or "IPv6 only allowed".
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-bearer-qmi.c | 17 | ||||
-rw-r--r-- | src/mm-modem-helpers-qmi.c | 15 | ||||
-rw-r--r-- | src/mm-modem-helpers-qmi.h | 1 |
3 files changed, 27 insertions, 6 deletions
diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c index 33b88606..97f9c079 100644 --- a/src/mm-bearer-qmi.c +++ b/src/mm-bearer-qmi.c @@ -1213,6 +1213,7 @@ register_for_wds_indication (ConnectContext *ctx, static GError * error_from_start_network_output (MMBearerQmi *self, + gboolean running_ipv4, QmiMessageWdsStartNetworkOutput *output) { QmiWdsCallEndReason cer; @@ -1224,7 +1225,9 @@ error_from_start_network_output (MMBearerQmi *self, &verbose_cer_type, &verbose_cer_reason, NULL)) { - return mm_error_from_wds_verbose_call_end_reason (verbose_cer_type, verbose_cer_reason, self); + return mm_error_from_wds_verbose_call_end_reason (verbose_cer_type, verbose_cer_reason, + running_ipv4 ? MM_BEARER_IP_FAMILY_IPV4 : MM_BEARER_IP_FAMILY_IPV6, + self); } if (qmi_message_wds_start_network_output_get_call_end_reason ( @@ -1277,7 +1280,7 @@ start_network_ready (QmiClientWds *client, mm_obj_msg (self, "couldn't start %s network: %s", ctx->running_ipv4 ? "IPv4" : "IPv6", error->message); if (g_error_matches (error, QMI_PROTOCOL_ERROR, QMI_PROTOCOL_ERROR_CALL_FAILED)) { g_clear_error (&error); - error = error_from_start_network_output (self, output); + error = error_from_start_network_output (self, ctx->running_ipv4, output); } } } @@ -1374,8 +1377,14 @@ packet_service_status_indication_cb (QmiClientWds *client, &verbose_cer_type, &verbose_cer_reason, NULL)) { - /* Create MM error based on the verbose call end reason details */ - connection_error = mm_error_from_wds_verbose_call_end_reason (verbose_cer_type, verbose_cer_reason, self); + /* Create MM error based on the verbose call end reason details. There is no real + * need for now to provide the correct IP type associated to the QMI WDS client + * that received the indication, because the type of errors that need this info + * would happen upon a Start Network operation, not after the modem has been + * connected. */ + connection_error = mm_error_from_wds_verbose_call_end_reason (verbose_cer_type, verbose_cer_reason, + MM_BEARER_IP_FAMILY_NONE, + self); } else if (qmi_indication_wds_packet_service_status_output_get_call_end_reason ( output, &cer, diff --git a/src/mm-modem-helpers-qmi.c b/src/mm-modem-helpers-qmi.c index 71c29e96..52ccfc87 100644 --- a/src/mm-modem-helpers-qmi.c +++ b/src/mm-modem-helpers-qmi.c @@ -3226,7 +3226,7 @@ static const InternalErrorMap internal_error_map[] = { /* QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_MAX_V4_CONNECTIONS */ /* QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_MAX_V6_CONNECTIONS */ { QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_APN_MISMATCH, FALSE, MM_MOBILE_EQUIPMENT_ERROR_MISSING_OR_UNKNOWN_APN }, - /* QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_IP_VERSION_MISMATCH */ + /* QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_IP_VERSION_MISMATCH: NOTE: this one is treated in a special way */ /* QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_DUN_CALL_DISALLOWED */ /* QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_INVALID_PROFILE */ /* QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_EPC_NONEPC_TRANSITION */ @@ -3250,10 +3250,20 @@ static const InternalErrorMap internal_error_map[] = { static GError * error_from_wds_verbose_call_end_reason_internal (QmiWdsVerboseCallEndReasonInternal vcer_reason, const gchar *vcer_reason_str, + MMBearerIpFamily ip_type, gpointer log_object) { guint i; + /* Try to normalize the "IP version mismatch" error based on the IP type being connected. But + * leave the original reason string to clearly show that we did this translation. */ + if (vcer_reason == QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_IP_VERSION_MISMATCH) { + if (ip_type == MM_BEARER_IP_FAMILY_IPV4) + vcer_reason = QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_PDN_IPV4_CALL_DISALLOWED; + else if (ip_type == MM_BEARER_IP_FAMILY_IPV6) + vcer_reason = QMI_WDS_VERBOSE_CALL_END_REASON_INTERNAL_PDN_IPV6_CALL_DISALLOWED; + } + for (i = 0; i < G_N_ELEMENTS (internal_error_map); i++) { if (internal_error_map[i].vcer == vcer_reason) { GError *error; @@ -3339,6 +3349,7 @@ error_from_wds_verbose_call_end_reason_3gpp (QmiWdsVerboseCallEndReason3gpp vce GError * mm_error_from_wds_verbose_call_end_reason (QmiWdsVerboseCallEndReasonType vcer_type, guint vcer_reason, + MMBearerIpFamily ip_type, gpointer log_object) { GError *error = NULL; @@ -3352,7 +3363,7 @@ mm_error_from_wds_verbose_call_end_reason (QmiWdsVerboseCallEndReasonType vcer_t switch (vcer_type) { case QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_INTERNAL: - error = error_from_wds_verbose_call_end_reason_internal (vcer_reason, vcer_reason_str, log_object); + error = error_from_wds_verbose_call_end_reason_internal (vcer_reason, vcer_reason_str, ip_type, log_object); break; case QMI_WDS_VERBOSE_CALL_END_REASON_TYPE_3GPP: error = error_from_wds_verbose_call_end_reason_3gpp (vcer_reason, vcer_reason_str, log_object); diff --git a/src/mm-modem-helpers-qmi.h b/src/mm-modem-helpers-qmi.h index 96b9ca85..daacca8c 100644 --- a/src/mm-modem-helpers-qmi.h +++ b/src/mm-modem-helpers-qmi.h @@ -258,6 +258,7 @@ gboolean qmi_personalization_feature_from_mm_modem_3gpp_facility (MMModem3gppFac void mm_register_qmi_errors (void); GError *mm_error_from_wds_verbose_call_end_reason (QmiWdsVerboseCallEndReasonType vcer_type, guint vcer_reason, + MMBearerIpFamily ip_type, gpointer log_object); gboolean mm_error_from_qmi_loc_indication_status (QmiLocIndicationStatus status, GError **error); |