diff options
author | Dan Williams <dan@ioncontrol.co> | 2025-03-06 08:33:29 -0600 |
---|---|---|
committer | Dan Williams <dan@ioncontrol.co> | 2025-05-08 18:14:24 -0500 |
commit | 4d2d01b2c6a0819d941a4ef2d257e5392af3e24f (patch) | |
tree | 3bcad5021316a3d55758da80310f3ffa738ea4e2 | |
parent | 4b0d3b7147a3fa8f669870e0a740a2b0121a475c (diff) |
broadband-bearer,modem-helpers: don't use or match disabled profiles
When matching profiles ignore disabled ones. When activating a
specific profile index, return an error if that profile is marked
as disabled.
Signed-off-by: Dan Williams <dan@ioncontrol.co>
-rw-r--r-- | src/mm-broadband-bearer.c | 8 | ||||
-rw-r--r-- | src/mm-modem-helpers.c | 6 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c index 69bf699b..dfd9d489 100644 --- a/src/mm-broadband-bearer.c +++ b/src/mm-broadband-bearer.c @@ -634,7 +634,13 @@ select_profile_3gpp_get_profile_ready (MMIfaceModem3gppProfileManager *modem, profile = mm_iface_modem_3gpp_profile_manager_get_profile_finish (modem, res, &error); if (!profile) g_task_return_error (task, error); - else + else if (!mm_3gpp_profile_get_enabled (profile)) { + g_task_return_new_error (task, + MM_CORE_ERROR, + MM_CORE_ERROR_FAILED, + "Profile '%d' is internally disabled", + ctx->profile_id); + } else g_task_return_int (task, ctx->profile_id); g_object_unref (task); } diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index 574ec7fc..fcb44ad2 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -1677,6 +1677,12 @@ mm_3gpp_profile_list_find_best (GList *profile_list, continue; } + /* Never select disabled profiles */ + if (!mm_3gpp_profile_get_enabled (iter_profile)) { + mm_obj_dbg (log_object, "skipping context at profile %d: disabled", iter_profile_id); + continue; + } + /* Always prefer an exact match; compare all supported fields except for profile id */ if (mm_3gpp_profile_cmp (iter_profile, requested, cmp_apn, cmp_flags)) { mm_obj_dbg (log_object, "found exact context at profile %d", iter_profile_id); |