fibocom: Minimum PDP context ID
Sven Schwermer
sven at svenschwermer.de
Wed Mar 9 07:31:49 UTC 2022
> The way to restrict the CID range to >= 1 would be to subclass the
> check_format() method in the MMIfaceModem3gppProfileManager, so that
> it returns a "min_profile_id" equal to 1. For that, you could just
> call the "parent" check_format() method, in order to use the generic
> +CGDCONT=? operation, but then overwrite the "min_profile_id" you get
> there (assuming you get 0) and return 1 instead in that field.
I believe this already happens, since +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)
The stock `check_format` determines the minimum context ID to be 1, see
the following log entry in my original email:
<debug> [modem0] +CGDCONT format details for PDP type 'ipv4': minimum 1,
maximum 7
<debug> [modem0] context definition format: minimum 1, maximum 7
However, `mm_3gpp_profile_list_find_best` only uses `min_profile_id` if
all else fails (which is not the case for me):
/* Otherwise, just fallback to min CID */
mm_obj_dbg (log_object, "falling back to profile %d", min_profile_id);
*out_reused = NULL;
*out_overwritten = TRUE;
return min_profile_id;
Would the following patch break any existing code?
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index 675f3be9..cb666c0b 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -1639,6 +1639,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",
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);
More information about the ModemManager-devel
mailing list