modem-helpers: Consider minimum ID when choosing best profile

+CGDCONT? may list profiles with IDs that are illegal to write, i.e.
+CGDCONT=? returns a minimum ID larger than some of the existing
profiles. E.g. for Fibocom L610-EU, +CGDCONT=? returns

+CGDCONT: (1-7),"IP",,,(0-3),(0-4)
+CGDCONT: (1-7),"IPV6",,,(0-3),(0-4)
+CGDCONT: (1-7),"IPV4V6",,,(0-3),(0-4)
+CGDCONT: (1-7),"PPP",,,(0-3),(0-4)
+CGDCONT: (1-7),"Non-IP",,,(0-3),(0-4)

while the default EPS bearer is established at profile 0:

+CGDCONT: 0,"IP","xxx","xxx.xxx.xxx.xxx",0,0
[...]

Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
This commit is contained in:
Sven Schwermer
2022-03-08 15:30:50 +01:00
committed by Aleksander Morgado
parent c74a377f98
commit 95eef34d37

View File

@@ -1629,6 +1629,11 @@ mm_3gpp_profile_list_find_best (GList *profile_list,
iter_profile_id = mm_3gpp_profile_get_profile_id (iter_profile);
if (iter_profile_id < min_profile_id) {
mm_obj_dbg (log_object, "skipping context at profile %d: out of bounds", 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);