Commit Graph

8691 Commits

Author SHA1 Message Date
Andrey Skvortsov
5eb3acee0a shared-qmi: fix memory leak in set_supl_server command
ctx->supl is allocated in mm_shared_qmi_location_set_supl_server
using g_strdup. g_strdup requires to free string when unneeded.

The problem could be reproduced using following commands
```
 while true; do
       mmcli -m any --location-set-supl-server="supl.google.com:7276";
       mem=$(cat /proc/$(pgrep ModemManager)/statm | awk '{print $6}')
       echo $(date +"%s"), $mem | tee -a mm-leak.log;
 done;
```
2023-06-23 23:19:53 +03:00
Aleksander Morgado
2ea67ae3e8 fibocom: limit multiplexing in NL668 to one single PDN
NL668 doesn't correctly support more than one multiplexed PDN
connection. Limit this explicitly so that it never attempts to use
more than one.

   #  mmcli -m a --simple-connect="multiplex=requested,apn=internet,ip-type=ipv4v6,apn-type=default"
   successfully connected the modem

   # mmcli -m a --simple-connect="multiplex=requested,apn=internet2,ip-type=ipv4v6,apn-type=default"
   error: couldn't connect the modem: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Unsupported: Invalid bearer properties: Maximum number of multiplexed bearers reached'
2023-06-16 21:00:16 +00:00
Aleksander Morgado
3004a3e532 broadband-modem-qmi|mbim: allow limiting multiplexed links with udev tags
Certain QMI or MBIM devices may not be able to support multiplexing at
all, or they may support a limited amount of links.

The new ID_MM_MAX_MULTIPLEXED_LINKS udev tag allows specifying the
maximum number of supported multiplexed links; e.g. 0 to report none
supported or 1 to report that one single multiplexed link is
supported.
2023-06-16 20:58:04 +00:00
Aleksander Morgado
547d40009c docs: add missing reference to ID_MM_REQUIRED 2023-06-16 09:01:34 +00:00
Aleksander Morgado
4db5635f44 iface-modem: sim swap check always refers to the active SIM
Since 503e886c02 the events on inactive SIMs don't trigger a full
modem reprobe, and the slot index check is fully unused.
2023-06-14 13:54:32 +00:00
Aleksander Morgado
af89e63c35 iface-modem: ignore sim swap check if not implemented
Explicitly return TRUE to indicate success because otherwise the
caller will expect a valid GError set.
2023-06-14 13:48:06 +00:00
Jordi Mas
a6a87e4a06 po: add Catalan translation 2023-06-14 09:16:23 +00:00
Ujjwal Pande
e3a1206c57 api: new carrier lock support
Adding support for carrier lock for MBIM modems using google simlock
mechanism.
2023-06-08 20:16:12 +00:00
Aleksander Morgado
97c32d6e51 build: unstable release version bump to 1.21.7 2023-06-06 13:27:12 +00:00
Sabri Unal
86970f6f18 po: update Turkish translation 2023-06-05 09:34:36 +00:00
Aleksander Morgado
614cc3e467 iface-modem-3gpp: cleanup packet service state on disabling
Otherwise the state cached by the protocol implementation will be
different to the one exposed in the 3GPP interface.
2023-05-25 08:19:37 +00:00
Aleksander Morgado
edf2235259 broadband-modem-mbim: common process for register state messages
Both the register state indications and the register state set
response messages will be processed in the same way.

This ensures that the registration state reported during the set
response, along with the additional info provided in that
message (e.g. access technologies) are taken into account.

This change also avoids fully relying on the register state
indications sent by the modem, as the indication may not be sent after
a successful update operation (given that the operation response
already contains the last valid state).
2023-05-25 08:19:37 +00:00
Aleksander Morgado
3424c17688 broadband-modem-mbim: run explicit packet service query
When running the 3GPP registration checks (e.g. after reaching enabled
state, or when synchronizing state after a quick suspend/resume), we
also update the current packet service state explicitly, without
needing to fully rely on the indications.
2023-05-25 08:19:37 +00:00
Aleksander Morgado
b7d94a4daa broadband-modem-mbim: common process for packet service messages
Both the packet service indications and the packet service set
response messages will be processed in the same way.

This ensures that the packet service state reported during the set
response, along with the additional info provided in that
message (e.g. speeds) are taken into account.

This change also avoids fully relying on the packet service
indications sent by the modem, as the indication may not be sent after
a successful update operation (given that the operation response
already contains the last valid state).
2023-05-24 10:34:30 +00:00
Kristian Sloth Lauszus
f32a625a56 mm-modem-helpers-ublox: added support for ublox LARA-R6001 / LARA-R6001D modules 2023-05-22 19:48:48 +02:00
Aleksander Morgado
b70fd80c0f charsets: fix read of uninitialized memory in gsm unpacked conversion
==1==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x59c6c88a31ef in gsm_ext_char_to_utf8 src/mm-charsets.c:256:13
    #1 0x59c6c88a31ef in charset_gsm_unpacked_to_utf8 src/mm-charsets.c:339:20
    #2 0x59c6c88a31ef in mm_modem_charset_bytearray_to_utf8 src/mm-charsets.c:857:30
    #3 0x59c6c889babd in sms_decode_address src/mm-sms-part-3gpp.c:143:16
    #4 0x59c6c8899d3a in mm_sms_part_3gpp_new_from_binary_pdu src/mm-sms-part-3gpp.c:514:15
2023-05-18 21:00:45 +00:00
Aleksander Morgado
a03da1f3cb broadband-modem: plug leak processing SIM loading steps
==6971== 52 (16 direct, 36 indirect) bytes in 1 blocks are definitely lost in loss record 3,764 of 6,140
  ==6971==    at 0x4842839: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==6971==    by 0x4A1ADE8: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==6971==    by 0x4A31FF1: g_slice_alloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==6971==    by 0x4A3266D: g_slice_alloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==6971==    by 0x49FD397: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==6971==    by 0x49FD8B4: g_error_new_valist (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==6971==    by 0x49FDACE: g_set_error (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==6971==    by 0x187A4C: mm_base_modem_peek_best_at_port (mm-base-modem.c:1129)
  ==6971==    by 0x184116: _at_command (mm-base-modem-at.c:634)
  ==6971==    by 0x1841FE: mm_base_modem_at_command (mm-base-modem-at.c:660)
  ==6971==    by 0x18F6F1: load_sim_identifier (mm-base-sim.c:2016)
  ==6971==    by 0x18CA03: mm_base_sim_load_sim_identifier (mm-base-sim.c:820)
2023-05-17 14:07:20 +02:00
Tom Wimmenhove
bd5a82845a mmcli: added --messaging-create-sms-with-text option
Added a `--messaging-create-sms-with-text' command line option that works similar to
`--messaging-create-sms-with-data', except that it uses the content of the file as the
message text instead of data.

This allows creating mesasges containing both double and single quotes, which was not
possible with the existing `--messaging-create-sms' command line option.
2023-05-17 10:08:03 +00:00
Nagi Marupaka
d95114a576 modem-helpers-mbim: allow optional outputs in mm_signal_from_mbim_signal_state()
Fixes 470dff235c
2023-05-17 09:43:11 +00:00
Nagi Marupaka
eeba2ff32b broadband-modem-mbim: account for race condition in quick hot swap case
On MBIM modems, when the SIM is ejected and re-inserted in a quick manner,
the state machine logic encounters a race condition and eventually, the
modem response for subscriber status is ignored. This change accounts
for that state transition without erroring out.

Fixes #672.
2023-05-12 11:46:17 +00:00
Nagi Marupaka
af44e8c1d8 mm-broadband-modem-mbim: fix log prints in certain notifications 2023-05-12 11:33:50 +00:00
Nagi Marupaka
110495dc44 mm-iface-modem: increase the SIM retries to 7
In some cases modem is taking 7 tries to detect an initialized SIM.
2023-05-11 18:20:45 +00:00
Aleksander Morgado
470dff235c broadband-modem-mbim: use MBIMEx v2 signal loading explicitly if supported 2023-05-11 11:18:56 +00:00
Aleksander Morgado
d3deb0ef0b iface-modem-signal: launch explicit signal query after setting up thresholds 2023-05-11 11:15:20 +00:00
Aleksander Morgado
1564b54cff broadband-modem-mbim: non-zero interval when enabling thresholds
Fix bug in Fibocom FM350 modem where a non-zero signal strength
interval needs to be configured as part of threshold setup.

Fixes #733
2023-05-11 11:13:35 +00:00
Aleksander Morgado
ecea0a16e1 sierra: port type hints for RC7611 2023-05-11 11:02:31 +00:00
Aleksander Morgado
45c7ad1e56 Revert "iface-modem-signal: send a query after threshold set up"
This reverts commit 17ed63637f.

We were reusing the signal_state_query_ready() callback in the wrong
way.
2023-05-10 19:58:07 +00:00
Nagi Marupaka
17ed63637f iface-modem-signal: send a query after threshold set up
After the setup of threshold for signal state notifications, trigger a
query of the current signal state values.
2023-05-10 09:02:16 +00:00
Sebastian Krzyszkowiak
9007d7999d broadband-modem-qmi: enable/disable messaging AT unsolicited events too
When the host is resuming from system suspend, QMI indications
sent by the modem at resume time can be lost. The exact reason why it
happens is still unknown. Until this is fixed, ModemManager currently
workarounds that in QMI mode by listening and reacting to AT URCs too,
which are being received reliably. In order to achieve that,
messaging_setup_unsolicited_events chains the parent's implementation
with its own, effectively setting up handlers for both AT and QMI
channels.

This worked fine on modems such as EG25 which enable SMS indications
by default. However, some modems, such as BM818, don't have these
indications enabled on boot and don't report incoming messages via AT
unless requested via AT+CNMI.

To make SMS handling on resume reliable on such modems, make sure
that MMBroadbandModemQmi also enables/disables unsolicited events
in the same way it already sets up handlers for them.

Signed-off-by: Sebastian Krzyszkowiak <dos@dosowisko.net>
2023-05-10 08:58:13 +00:00
Maxim Anisimov
7f476c2e27 libmm-glib,location-3gpp: fix conversion to gulong in mm_location_3gpp_new_from_string_variant
Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
2023-05-09 09:15:12 +00:00
Aleksander Morgado
2455981ad6 build: unstable release version bump to 1.21.6 2023-05-03 19:59:37 +00:00
Aleksander Morgado
f3cdafb746 shared-qmi: don't assume cancellation signal handler is setup in the registration wait
The cancellation_id will not be set if the cancellable is already
cancelled by the time g_cancellable_connect() is called.
2023-05-03 14:25:51 +00:00
Aleksander Morgado
28eec45dbb shared-qmi: ensure cancellation is setup last in the registration wait
register_in_network_cancelled() may be called early if the given
cancellable is already cancelled, and if so, we want it to remove the
timeout and signal handler, which should have been configured before
setting up the cancellation signal handler.
2023-05-03 14:21:31 +00:00
Aleksander Morgado
5bd8bbb408 broadband-modem-mbim: group together all runtime state while enabled in its own struct 2023-05-03 13:00:47 +00:00
Aleksander Morgado
60735b2ea0 bearer-list: rename variables in the foreach contexts
So that the variable names in each context identify the action being
performed, to easier reading.
2023-05-03 12:42:09 +00:00
Aleksander Morgado
2895a4bb52 broadband-modem-mbim: ignore registration set error if NwError=0 reported
Returning an error in the registration set request completely breaks
the async operation requesting the explicit registration, even if the
modem may have already been registered via indications while waiting
for the set request to be completed.

We now ignore the registration set error if it returns a generic
failure with NwError=0, as in certain Qualcomm based devices. We
ignore unconditionally, without explicitly checking if we're
registered or not, because the upper logic will anyway do that.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/723
2023-05-03 12:38:43 +00:00
Aleksander Morgado
f922a6be2d broadband-modem-mbim: ensure cached state info is reseted on disable
So that it is reloaded fresh once re-enabled, otherwise we may be
using stale state values that are not in sync with the state reported
in the interface skeletons.
2023-05-03 12:38:43 +00:00
Aleksander Morgado
22c4d88a24 iface-modem-3gpp: skip interface updates if it's disabled
E.g. we don't want to update the 3GPP registration state to "idle" if
the interface has already been disabled:

   <msg> [1681814812.903723] [modem0] 3GPP registration state changed (idle -> unknown)
   <inf> [1681814812.903842] [modem0] consolidated registration state: cs 'idle', ps 'idle', eps 'idle', 5gs 'unknown' --> 'unknown'
   <dbg> [1681814812.906194] [modem0] disabling the Modem interface...
   <inf> [1681814812.911148] [modem0] disabled modem
   <dbg> [1681814812.913453] [ttyACM0/at] device open count is 0 (close)
   <dbg> [1681814812.913629] [ttyACM0/at] closing serial port...
   <dbg> [1681814812.915559] [ttyACM0/at] serial port closed
   <msg> [1681814812.916569] [modem0] state changed (disabling -> disabled)
   <dbg> [1681814868.945069] [/dev/cdc-wdm4] number of consecutive timeouts: 1
   <msg> [1681814868.950724] [modem0] 3GPP registration state changed (unknown -> idle)
   <inf> [1681814868.950885] [modem0] consolidated registration state: cs 'idle', ps 'idle', eps 'idle', 5gs 'unknown' --> 'idle'
   <msg> [1681814868.951797] [modem0] state changed (disabled -> enabled)
   <dbg> [1681814868.955740] [modem0] registration in network: cancelled
   <wrn> [1681814868.958562] [modem0] registration in network failed: Operation was cancelled
2023-05-03 12:38:43 +00:00
Aleksander Morgado
e1691780f7 iface-modem-3gpp: coding style updates in initialization sequence 2023-05-03 12:38:43 +00:00
Aleksander Morgado
db6b45fa10 iface-modem-3gpp: coding style changes in initial EPS bearer update logic 2023-05-03 12:38:43 +00:00
Aleksander Morgado
8198a04f1a iface-modem-simple: improve logging and cancellability in network registration sequence 2023-05-03 12:38:43 +00:00
Aleksander Morgado
ef1887df05 iface-modem-3gpp: coding style updates in enabling/disabling sequences 2023-05-03 12:38:43 +00:00
Aleksander Morgado
d906443eee broadband-modem: explicitly abort ongoing attempt when disabling 2023-05-03 12:38:43 +00:00
Aleksander Morgado
200f827d38 bearer-list: new common method to disconnect one or all bearers 2023-05-03 12:38:43 +00:00
Aleksander Morgado
acc98e43ba iface-modem-3gpp: allow cancelling the wait for packet service state
When a request to disable the modem arrives while the packet service
state wait is ongoing we were not correctly cancelling the operation.
The main reason for this is that this operation does not change the
modem state, and so the "wait for final state" logic in the disabling
sequence was not being considered.

We solve this by plugging in the Simple.Connect() operation
cancellable in the wait for packet service state operation. The
connection attempt will be cancelled during the disabling sequence as
well, and when that happens we will explicitly halt the packet service
state wait as well.
2023-05-03 12:38:43 +00:00
Aleksander Morgado
b9a7cad247 iface-modem-3gpp: minor rename of variables 2023-05-03 12:27:21 +00:00
Aleksander Morgado
d77674d3f4 broadband-modem-qmi: use DSD system status to report packet service state
We now support modem-reported packet service state, instead of
guessing it in the 3GPP interface logic.

The DSD system status reporting a valid access technology is an
indication that the packet service is ready. Instead of holding back
the registration status until the DSD system status reports a valid
value, we will now report the modem as registered, and bind the DSD
system status exclusively to the packet service status.

In the simple connection attempt we're already waiting first for being
registered, and then for being attached in PS.
2023-05-03 12:27:20 +00:00
Aleksander Morgado
22ac850eb6 broadband-modem-mbim: minor refactor in speeds reporting 2023-05-03 12:27:20 +00:00
Aleksander Morgado
6b05e268e0 broadband-modem-mbim: report packet service state updates
Use the Packet Service messages to report the state of PS domain,
instead of guessing.
2023-05-03 12:27:20 +00:00
Aleksander Morgado
45406e78e2 iface-modem-3gpp: don't guess packet service state if modem can report it
In certain protocols like QMI or MBIM we may be able to report an
exact packet service state, so there is no need to guess it, as the
guess may not always be right.

The logic will track automatically whether modem-reported packet
service states are available, and use them if so. Otherwise, it'll try
to guess as we were doing before (e.g. if registered in EPS, packet
service is considered attached).
2023-05-03 12:12:18 +00:00