summaryrefslogtreecommitdiff
path: root/src/mm-modem-helpers.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2018-04-28 10:38:53 +0200
committerAleksander Morgado <aleksander@aleksander.es>2018-04-30 18:25:49 +0200
commite17d5a51a24248d53ea5da8d16d86f2ca187a566 (patch)
tree99a55dfc172931d7feed082214b9ca6049343651 /src/mm-modem-helpers.c
parent43d0bd0f9135512a0531b5808354e00db9d6f22a (diff)
downloadModemManager-e17d5a51a24248d53ea5da8d16d86f2ca187a566.tar.gz
broadband-bearer: allow matching empty APN when looking for PDP CID
The PDP contexts that are found with an empty APN configured are right now used as placeholders that can be overwritten with the user provided APN if no direct match is found. We want to keep that logic in place, but for the case where we do get an empty APN requested by the user, we need to perform the full context match, so that the first PDP context matching the empty APN is used. Right now we're overwriting with the empty APN again the last PDP context found with an empty APN, which doesn't make much sense: Apr 27 08:15:21 ModemManager[4251]: <debug> Found '3' PDP contexts Apr 27 08:15:21 ModemManager[4251]: <debug> PDP context [cid=1] [type='ipv4'] [apn=''] Apr 27 08:15:21 ModemManager[4251]: <debug> PDP context [cid=2] [type='ipv4'] [apn='broadband'] Apr 27 08:15:21 ModemManager[4251]: <debug> PDP context [cid=15] [type='ipv4'] [apn=''] Apr 27 08:15:21 ModemManager[4251]: <debug> Found PDP context with CID 1 and no APN Apr 27 08:15:21 ModemManager[4251]: <debug> Found PDP context with CID 15 and no APN Apr 27 08:15:21 ModemManager[4251]: <debug> (ttyUSB3) device open count is 3 (open) Apr 27 08:15:21 ModemManager[4251]: <debug> (ttyUSB3) device open count is 2 (close) Apr 27 08:15:21 ModemManager[4251]: <debug> (ttyUSB3): --> 'AT+CGDCONT=15,"IP",""<CR>' Apr 27 08:15:21 ModemManager[4251]: <debug> (ttyUSB3): <-- '<CR><LF>OK<CR><LF>'
Diffstat (limited to 'src/mm-modem-helpers.c')
-rw-r--r--src/mm-modem-helpers.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index 48cd1e168..c25867120 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -1305,6 +1305,10 @@ mm_3gpp_cmp_apn_name (const gchar *requested,
size_t requested_len;
size_t existing_len;
+ /* If both empty, that's a good match */
+ if ((!existing || !existing[0]) && (!requested || !requested[0]))
+ return TRUE;
+
/* Both must be given to compare properly */
if (!existing || !existing[0] || !requested || !requested[0])
return FALSE;