summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Mazur <mkm@semihalf.com>2023-03-27 23:42:45 +0200
committerAleksander Morgado <aleksander@aleksander.es>2023-03-30 19:58:09 +0000
commit5656d01099e0532dcdbfa85bf23af8c677a7d07c (patch)
tree7995d8790ab7056e38b453a0fc51e2215b4c636b
parent3aefc983b5d73b2c822807b23be9f76a95b11139 (diff)
downloadModemManager-5656d01099e0532dcdbfa85bf23af8c677a7d07c.tar.gz
bearer-mbim: use mobile equipment error only if set
Always prefer the operation error when the nw_error is not set (has value MBIM_NW_ERROR_NONE). If the activation state is ACTIVATED or ACTIVATING then the behavior doesn't change.
-rw-r--r--src/mm-bearer-mbim.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c
index 713b7aafb..fc434c787 100644
--- a/src/mm-bearer-mbim.c
+++ b/src/mm-bearer-mbim.c
@@ -714,8 +714,12 @@ connect_set_ready (MbimDevice *device,
mbim_nw_error_get_string (nw_error));
/* 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 &&
+ * 'pdp-type-ipv4-only-allowed' nw_error).
+ * If the nw_error is not set (MBIM_NW_ERROR_NONE), we prefer to
+ * return any operation error (e.g. 'OperationNotAllowed') instead
+ * of MM_MOBILE_EQUIPMENT_ERROR_UNKNOWN ('Unknown error'). */
+ if (nw_error != MBIM_NW_ERROR_NONE &&
+ activation_state != MBIM_ACTIVATION_STATE_ACTIVATED &&
activation_state != MBIM_ACTIVATION_STATE_ACTIVATING) {
g_clear_error (&error);
error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error, self);