From 5656d01099e0532dcdbfa85bf23af8c677a7d07c Mon Sep 17 00:00:00 2001 From: Michal Mazur Date: Mon, 27 Mar 2023 23:42:45 +0200 Subject: 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. --- src/mm-bearer-mbim.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c index 713b7aaf..fc434c78 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); -- cgit v1.2.3-70-g09d2