Commit Graph
100 Commits
Author SHA1 Message Date
Aleksander Morgado ed3871b394 AUTHORS: update 2023-09-29 11:32:16 +00:00
Aleksander Morgado aa7ab917f7 build: bump version to 1.21.900 (1.22-rc1) 2023-09-27 11:26:32 +00:00
Aleksander Morgado be640af246 NEWS: update for 1.22.0 2023-09-27 11:22:14 +00:00
Aleksander Morgado 9f4c738d1f test,mmsmspdu: add support for MSG log level 2023-09-27 11:21:26 +00:00
Aleksander Morgado 7990499602 base-modem: minor alignment fix 2023-09-27 10:24:58 +00:00
Aleksander Morgado 359b75bf9d device: plug leak of the physdev string 2023-09-27 10:08:59 +00:00
Aleksander Morgado d06a8cee25 api: add comment about "MSG" level being available only since 1.22 2023-09-27 09:07:24 +00:00
Aleksander Morgado 1fc58d4749 broadband-modem: don't assert if no AT port in QMI modem enabling unsolicited messages
2023-09-11T20:23:49.294555Z <err> mm_port_get_device: assertion 'self != NULL' failed
  2023-09-11T20:23:49.294691Z <dbg> [modem0] enabling messaging unsolicited events on primary port (null)
  2023-09-11T20:23:49.294865Z <dbg> [modem0] enabling parent messaging unsolicited events failed: Cannot run sequence: port not given
2023-09-11 22:37:46 +00:00
Aleksander Morgado 36dc193b40 iface-modem-simple: ignore ps wait state result, only check error
As we do in the similar modem state wait operations in the modem
interface, the caller of the wait operation may ignore the state
result as it's really not required in this case. Only looking at
whether an error is set or not is enough.

This by itself fixes a crash where
mm_iface_modem_3gpp_wait_for_packet_service_state_finish() may have
returned UNKNOWN without error set.

  0x000079616c2564ed (libglib-2.0.so.0 - gtestutils.c: 3256)      g_assertion_message
  0x000079616c25654b (libglib-2.0.so.0 - gtestutils.c: 3282)      g_assertion_message_expr
  0x000057ba46231150 (ModemManager - mm-iface-modem-simple.c: 344)        packet_service_attach_in_3gpp_network_step
  0x000079616c0efb02 (libgio-2.0.so.0 - gtask.c: 1232)    g_task_return_now
  0x000079616c0eeb54 (libgio-2.0.so.0 - gtask.c: 1301)    g_task_return
  0x000057ba4620e5bd (ModemManager - mm-iface-modem-3gpp.c: 189)  wait_for_packet_service_state_context_complete
  0x000057ba4620b441 (ModemManager - mm-iface-modem-3gpp.c: 261)  packet_service_state_changed
2023-09-11 19:39:59 +00:00
Aleksander Morgado 47239b8499 iface-modem-3gpp: ensure error is set when UNKNOWN returned in ps state wait 2023-09-11 19:39:59 +00:00
Aleksander Morgado c1382b3255 iface-modem: ensure error is set when UNKNOWN returned in modem state wait 2023-09-11 19:39:59 +00:00
Aleksander Morgado 5adda62912 iface-modem-3gpp: ignore UNKNOWN ps state explicitly during wait operation 2023-09-11 19:39:59 +00:00
Aleksander Morgado fb66cc26be iface-modem: ignore UNKNOWN modem state explicitly during wait operation 2023-09-11 19:39:59 +00:00
Aleksander Morgado 639900ed36 build: unstable release version bump to 1.21.8 2023-08-07 05:01:31 +00:00
Aleksander Morgado 50caac4bdd fibocom: disable multiplexing support in NL668
The NL668 doesn't seem to support multiplexing, as it fails to
transfer data even in the one multiplexed PDN case.
2023-08-05 22:08:01 +00:00
Aleksander Morgado 3008012adc bearer-mbim: simplify the logic to require static IPv6 addressing
Rely exclusively on whether a global IPv6 was given or not, regardless
of what the DNS or gateway settings are, same as we do for IPv4.

Also, assume we only get 1 single IPv6 address. No need to have a
FIXME to add support for more addresses.
2023-08-04 11:57:52 +02:00
Aleksander Morgado c1fc816d0c plugin-manager: increase probing timeouts
This will make device probing slower unconditionally, but it should
also ensure newer more complex devices that take longer to boot are
handled properly.
2023-07-28 08:57:22 +00:00
Aleksander Morgado b75198d9f9 broadband-modem-mbim: only update bearer speeds if connected
We should not update speeds on already disconnected bearers.
2023-07-14 13:02:39 +00:00
Aleksander Morgado 32b3aee8f0 broadband-modem-mbim: reset packet service state if unregistered 2023-07-14 13:02:39 +00:00
Aleksander Morgado 22d06d6b53 broadband-modem-mbim: propagate packet service state to 3GPP iface unconditionally 2023-07-14 10:33:06 +00:00
Aleksander Morgado 0724f45731 build: require udevdir if udev support is disabled
We cannot guess the udevdir path from the pkgconfig variable if there
is no udev support in the system, so explicitly fail.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/750
2023-07-13 10:22:05 +00:00
Aleksander Morgado 53f063b851 quectel: avoid assuming modem is MBIM capable in shared utils
(ModemManager:10426): GLib-GObject-WARNING **: 09:44:23.142: invalid cast from 'MMBroadbandModemQmiQuectel' to 'MMBroadbandModemMbim'
  **
  ERROR:../git/src/mm-broadband-modem-mbim.c:284:mm_broadband_modem_mbim_peek_port_mbim: assertion failed: (MM_IS_BROADBAND_MODEM_MBIM (self))
  Bail out! ERROR:../git/src/mm-broadband-modem-mbim.c:284:mm_broadband_modem_mbim_peek_port_mbim: assertion failed: (MM_IS_BROADBAND_MODEM_MBIM (self))

See https://lists.freedesktop.org/archives/modemmanager-devel/2023-July/009729.html
2023-07-07 05:50:12 +00: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
Aleksander Morgado 97c32d6e51 build: unstable release version bump to 1.21.7 2023-06-06 13:27:12 +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
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 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
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 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
Aleksander Morgado bf2843ad77 libmm-glib: separate files for flags and enums types
This allows us to skip needing to include the non-existent
build_string_from_mask() or get_string() counterparts in the
documentation index.
2023-04-27 12:23:04 +00:00
Aleksander Morgado fdf03f9b2c build-aux,mkenums: use mixed enums+flags template without docs in daemon 2023-04-27 12:23:04 +00:00
Aleksander Morgado efcfce02a9 build-aux,mkenums: import custom mkenums tool from libqmi/libmbim
We're going to use certain new features included in the custom tool.
2023-04-27 12:23:04 +00:00
Aleksander Morgado 1a133dca5e helpers-mbim: fix MMSignal selection based on data class
MbimDataClass is a flags bitmask, not an enumeration.

This logic was broken if the reported data class was e.g. 4G+5GNSA.
2023-04-19 11:32:01 +00:00
Aleksander Morgado 552359b57e docs: update copyright 2023-04-14 08:50:38 +00:00
Aleksander Morgado c0e613ee35 daemon: update copyright 2023-04-14 08:49:29 +00:00
Aleksander Morgado 19b910b60f cli: update copyright 2023-04-14 08:48:35 +00:00
Aleksander Morgado 7e0663f922 udev: new ID_MM_REQUIRED tag
Users with QMI or MBIM capable modems may want to ensure that these
are never managed using plain AT commands, as that also involves using
PPP. This fallback to AT could happen if the QMI or MBIM port probing
fails for whatever reason.

The new `ID_MM_REQUIRED` udev tag allows specifying that a given port
MUST be successfully grabbed when creating a new modem object, or
otherwise the modem object will not be created at all (even if there
are other fallback control ports like AT that could have been used).

Use this tag with caution.

It is assumed that when this tag is used some other external process
may be monitoring the existence of the modem object in DBus as exposed
by ModemManager, and if it does not appear for any reason then the
modem would be reseted with some other mechanism (e.g. GPIOs, if
available). If no such mechanism to autorecover the modem is in place,
using this tag may leave the modem exposed in the kernel but ignored
by ModemManager.

This tag must be applied on the specific port for which the existence
and usability must be ensured.

E.g. flagging the MBIM port of the Fibocom L850 module as required:

   $ vim /lib/udev/rules.d/78-mm-test.rules
   ACTION!="add|change|move|bind", GOTO="mm_test_rules_end"
   SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}"
   ATTRS{idVendor}=="2cb7", ATTRS{idProduct}=="0007", ENV{.MM_USBIFNUM}=="00", ENV{ID_MM_REQUIRED}="1"
   LABEL="mm_test_rules_end"

   $ sudo udevadm control --reload
   $ sudo udevadm trigger

   $ sudo udevadm info -p /sys/class/usbmisc/cdc-wdm0
   ...
   E: ID_MM_REQUIRED=1
   E: ID_MM_CANDIDATE=1
2023-04-13 11:54:04 +00:00
Aleksander Morgado 79b15cf87c plugin: refactor how list of probe flags is built
To make it clearer that the initial list of flags must be the one
based on which ones are expected in the subsystem and which one the
plugin is requesting.
2023-04-13 11:54:03 +00:00
Aleksander Morgado cb2dea5dc4 port-probe: perform auto detection of port type hints for wwan
We can remove the port type hint udev tags for the wwan subsystem, as
that logic is now incorporated in the port type hint processing logic
in the daemon itself.

This makes it clearer to know what exact hints are being used, as the
logic is in a single place and it has proper logging of all possible
cases.
2023-04-13 11:53:54 +00:00
Aleksander Morgado e77df40b68 port-probe: perform auto detection of port type hints for cdc_wdm
Do not do this in the plugin; instead, do it along with the logic that
looks for port type hints in udev, so that we can properly warn if
things don't match.
2023-04-13 11:53:03 +00:00
Aleksander Morgado 131e783a5f port-probe: improve logging of detected port type hints in udev tags
Explicitly log when a tag is found, and also warn if too many por type
hints are provided in the same port.
2023-04-13 11:49:19 +00:00
Aleksander Morgado 585d2af713 port-probe: simplify AT port type hints handling
When processing the hints for port probing we don't care if the AT
port is flagged as primary or secondary.
2023-04-13 11:44:50 +00:00
Aleksander Morgado 4e879cbede iface-modem: fix incorrectly halted periodic signal checks
Whenever an explicit signal refresh was requested we would flag the
check as ongoing but never reset the flag, so it would never attempt
to reload it again.

Fixes 0080ed612d
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/702
2023-04-11 10:47:19 +00:00
Aleksander Morgado c61a7db1b6 helpers-qmi: support new personalization feature status type
The personalization feature enum used in "card status" is different to
the one used in other UIM operations like "depersonalization".

libqmi dependency updated to 1.33.6 to ensure we can use the new types.
2023-04-11 09:44:47 +00:00
Aleksander Morgado 06646001ce ci: don't attempt to build container on branches or pushes 2023-04-10 16:54:30 +00:00
Aleksander Morgado 06618fb3ae ci: add explicit debug build with all features
The release buildtype will disable certain warnings that we do see in
debug builds. Ensure we have a test build with all features enabled in
debug mode.
2023-04-10 15:47:06 +00:00
Aleksander Morgado 2af954a21a ci: always build with -Dwerror=true
Selecting the build type as release limits the amount of warnings that
are enabled, so ensure we always build with warnings treated as errors
so that we don't miss any warning that would happen on debug builds.
2023-04-10 15:30:06 +00:00
Aleksander Morgado e3c3604838 cinterion: fix missing object in mm_obj_dbg() calls 2023-04-10 15:06:28 +00:00
Aleksander Morgado a53990e074 cinterion: fix warning with -Wmissing-prototypes
../src/plugins/cinterion/mm-plugin-cinterion.c:65:1: warning: no previous prototype for ‘is_port_already_tagged’ [-Wmissing-prototypes]
     65 | is_port_already_tagged (MMPortProbe *probe)
        | ^~~~~~~~~~~~~~~~~~~~~~
2023-04-10 15:05:24 +00:00
Aleksander Morgado 11539a2d82 sms-part-cdma: fix invalid reads due to wrong byte counts in read_bits
==174467== Invalid read of size 1
  ==174467==    at 0x10B80C: read_bits (mm-sms-part-cdma.c:255)
  ==174467==    by 0x10B886: read_bits (mm-sms-part-cdma.c:260)
  ==174467==    by 0x10DC2F: read_bearer_data_user_data (mm-sms-part-cdma.c:882)
  ==174467==    by 0x10DC2F: read_bearer_data (mm-sms-part-cdma.c:1000)
  ==174467==    by 0x10DC2F: mm_sms_part_cdma_new_from_binary_pdu (mm-sms-part-cdma.c:1180)
  ==174467==    by 0x10DF24: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:331)
  ==174467==    by 0x10A91D: common_test_valid_part_from_hexpdu (test-sms-part-cdma.c:114)
  ==174467==    by 0x10B0AC: common_test_valid_part_from_pdu (test-sms-part-cdma.c:126)
  ==174467==    by 0x10B0AC: test_invalid_ascii_user_data (test-sms-part-cdma.c:412)
  ==174467==    by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==  Address 0x51a6457 is 0 bytes after a block of size 7 alloc'd
  ==174467==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==174467==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==174467==    by 0x10DF06: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:325)
  ==174467==    by 0x10A91D: common_test_valid_part_from_hexpdu (test-sms-part-cdma.c:114)
  ==174467==    by 0x10B0AC: common_test_valid_part_from_pdu (test-sms-part-cdma.c:126)
  ==174467==    by 0x10B0AC: test_invalid_ascii_user_data (test-sms-part-cdma.c:412)
  ==174467==    by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==174467==    by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
2023-03-30 22:51:48 +00:00
Aleksander Morgado 1b60330032 sms-part-cdma: fix invalid memory read when parsing empty ascii text
Same fix also applied to latin encoded text as it also makes sense there.

  ==158856== Invalid read of size 1
  ==158856==    at 0x10B814: read_bits (mm-sms-part-cdma.c:257)
  ==158856==    by 0x10DB07: read_bearer_data_user_data (mm-sms-part-cdma.c:878)
  ==158856==    by 0x10DB07: read_bearer_data (mm-sms-part-cdma.c:990)
  ==158856==    by 0x10DB07: mm_sms_part_cdma_new_from_binary_pdu (mm-sms-part-cdma.c:1170)
  ==158856==    by 0x10DE54: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:333)
  ==158856==    by 0x10A916: common_test_invalid_part_from_hexpdu (test-sms-part-cdma.c:90)
  ==158856==    by 0x10A916: common_test_invalid_part_from_pdu (test-sms-part-cdma.c:104)
  ==158856==    by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A02BBC: g_test_run (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x10A509: main (test-sms-part-cdma.c:595)
  ==158856==  Address 0x51a627b is 0 bytes after a block of size 11 alloc'd
  ==158856==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==158856==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==158856==    by 0x10DE36: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:327)
  ==158856==    by 0x10A916: common_test_invalid_part_from_hexpdu (test-sms-part-cdma.c:90)
  ==158856==    by 0x10A916: common_test_invalid_part_from_pdu (test-sms-part-cdma.c:104)
  ==158856==    by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==    by 0x4A02BBC: g_test_run (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==158856==
2023-03-30 22:07:47 +00:00
Aleksander Morgado 6dccfc5abd sms-part-cdma: fix warning when attempting g_convert() with NULL input
GLib-CRITICAL **: 21:21:51.419: g_convert: assertion 'str != NULL' failed

  Program received signal SIGTRAP, Trace/breakpoint trap.
  0x00007ffff7db3e82 in g_logv () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  (gdb) bt
  #0  0x00007ffff7db3e82 in g_logv () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #1  0x00007ffff7db40ef in g_log () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #2  0x00007ffff7d8a5da in g_convert () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #3  0x00005555555592cf in read_bearer_data_user_data (log_object=0x0, subparameter=<optimized out>, sms_part=0x555555578000)
      at ../src/mm-sms-part-cdma.c:929
  #4  read_bearer_data (log_object=0x0, parameter=<optimized out>, sms_part=0x555555578000) at ../src/mm-sms-part-cdma.c:982
  #5  mm_sms_part_cdma_new_from_binary_pdu
2023-03-30 22:07:45 +00:00
Aleksander Morgado fae6d20ed0 sms-part-cdma: fix assertion in cause codes parameter id
ERROR:../src/mm-sms-part-cdma.c:678:read_cause_codes: assertion
  failed: (parameter->parameter_id == PARAMETER_ID_BEARER_REPLY_OPTION)
2023-03-30 21:16:58 +00:00
Aleksander Morgado 3d9497ffbe sms-part-3gpp: fix invalid memory ready by checking UDH length byte can be read
[debug] parsing PDU (0)...
  [debug]   no SMSC address given
  [debug]   submit type PDU detected
  [debug]   message reference: 1
  [debug]   address size: 1 digits (1 bytes)
  [debug]   number parsed: 00
  [debug]   validity available, format relative
  [debug]   PID: 0
  [debug]   user data encoding is GSM7
  [debug]   user data length: 0 elements
  [debug]   user data length: 0 bytes

  ==125780== Command: ./build/test/mmsmspdu --pdu=00F101010C0000000000 --verbose
  ==125780==
  ==125780== Invalid read of size 1
  ==125780==    at 0x10B422: mm_sms_part_3gpp_new_from_binary_pdu (mm-sms-part-3gpp.c:698)
  ==125780==    by 0x10BF57: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:368)
  ==125780==    by 0x10A44D: main (mmsmspdu.c:242)
  ==125780==  Address 0x519988a is 0 bytes after a block of size 10 alloc'd
  ==125780==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==125780==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==125780==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==125780==    by 0x10BF36: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:362)
  ==125780==    by 0x10A44D: main (mmsmspdu.c:242)
2023-03-30 21:04:57 +00:00
Aleksander Morgado dbafff23a4 sms-part-3gpp: avoid underflow in tp_user_data_size_elements
==101461== Command: ./build/test/mmsmspdu --pdu=004100010100014B00002E --verbose
  ==101461==
  [debug] parsing PDU (0)...
  [debug]   no SMSC address given
  [debug]   submit type PDU detected
  [debug]   message reference: 0
  [debug]   address size: 1 digits (1 bytes)
  [debug]   number parsed: 00
  [debug]   PID: 1
  [debug]   user data encoding is GSM7
  [debug]   user data length: 0 elements
  [debug]   user data length: 0 bytes
  [debug] decoding SMS text with 4294967294 elements

Based on a patch from Michal Mazur <mkm@semihalf.com>.
2023-03-30 20:32:37 +00:00
Aleksander Morgado 60ef408cd7 sms-part-3gpp: fix invalid memory read due to wrong size check when reading address
Before the actual number digits there is always a Type of Address byte
that we were not considering during the size check.

  [debug] parsing PDU (0)...
  [debug]   no SMSC address given
  [debug]   deliver type PDU detected
  [debug]   address size: 1 digits (1 bytes)

  ==90832== Command: ./build/test/mmsmspdu --pdu=001C011C --verbose
  ==90832==
  ==90832== Invalid read of size 1
  ==90832==    at 0x10AC90: sms_semi_octets_to_bcd_string (mm-sms-part-3gpp.c:71)
  ==90832==    by 0x10AC90: sms_decode_address (mm-sms-part-3gpp.c:157)
  ==90832==    by 0x10B0C5: mm_sms_part_3gpp_new_from_binary_pdu (mm-sms-part-3gpp.c:512)
  ==90832==    by 0x10BF77: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:368)
  ==90832==    by 0x10A44D: main (mmsmspdu.c:242)
  ==90832==  Address 0x5199874 is 0 bytes after a block of size 4 alloc'd
  ==90832==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==90832==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==90832==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==90832==    by 0x10BF56: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:362)
  ==90832==    by 0x10A44D: main (mmsmspdu.c:242)
2023-03-30 20:32:37 +00:00
Aleksander Morgado bc2aeeb7bd sms-part-3gpp: fix invalid memory read parsing address
[debug] parsing PDU (0)...
    [debug]   no SMSC address given
    [debug]   status report type PDU detected
    [debug]   message reference: 191
    [debug]   address size: 0 digits (0 bytes)

  ==78906== Command: ./build/test/mmsmspdu --pdu=000ABF00 --verbose
  ==78906==
  ==78906== Invalid read of size 1
  ==78906==    at 0x10AA80: sms_decode_address (mm-sms-part-3gpp.c:132)
  ==78906==    by 0x10AF7C: mm_sms_part_3gpp_new_from_binary_pdu (mm-sms-part-3gpp.c:507)
  ==78906==    by 0x10BE17: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:368)
  ==78906==    by 0x10A44D: main (mmsmspdu.c:202)
  ==78906==  Address 0x5199874 is 0 bytes after a block of size 4 alloc'd
  ==78906==    at 0x48455EF: calloc (vg_replace_malloc.c:1328)
  ==78906==    by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
  ==78906==    by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884)
  ==78906==    by 0x10BDF6: mm_sms_part_3gpp_new_from_pdu (mm-sms-part-3gpp.c:362)
  ==78906==    by 0x10A44D: main (mmsmspdu.c:202)
2023-03-30 20:32:37 +00:00
Aleksander Morgado 5d64ea7633 test-sms-part-3gpp: prepare common invalid PDU tester operation 2023-03-30 20:25:24 +00:00
Aleksander Morgado 7ec71020e7 test,mmsmspdu: fix verbose logging support 2023-03-30 20:14:44 +00:00
Aleksander Morgado 3aefc983b5 sms-part-3gpp|cdma: new fuzzer tests 2023-03-30 13:19:30 +00:00
Aleksander Morgado ea441d0f89 sierra: add EM7455 port type hints 2023-03-27 13:23:43 +00:00
Aleksander Morgado e5493127cd quectel: no real requirement for QCDM
The supported Quectel modules are usually QMI based and therefore
very new, there is no real requirement to support QCDM based
management.
2023-03-27 12:54:46 +00:00
Aleksander Morgado e81ae2b2b1 broadmobi: no real requirement for QCDM
The supported broadmobi modules are usually QMI based and therefore
very new, there is no real requirement to support QCDM based
management.
2023-03-27 12:54:46 +00:00
Aleksander Morgado 11219ed0d8 sierra: no real requirement for QCDM
The QCDM ports are not strictly required in the Sierra plugin, as this
plugin deals exclusively with QMI and MBIM capable devices.
2023-03-27 12:54:46 +00:00
Aleksander Morgado 70c8fe1fef build: unstable release version bump to 1.21.5 2023-03-24 13:14:10 +00:00
Aleksander Morgado 8f91060936 broadband-modem-qmi: avoid duplicating code in operating mode update logic 2023-03-24 13:02:35 +00:00
Aleksander Morgado 03b1422132 broadband-modem-qmi: fix return type of GSourceFunc callback 2023-03-24 13:02:35 +00:00
Aleksander Morgado b0fce20f73 port-qmi: read checksum offload link flags to use from kernel rmnet driver
The feature/rx_offload and feature/tx_offload sysfs attributes specify
which offload settings should be used when creating new links.
2023-03-24 12:07:00 +00:00
Aleksander Morgado f96664a159 broadband-modem-qmi: ignore profile updates during 100ms after our own updates 2023-03-22 17:42:28 +00:00
Aleksander Morgado 1b2a2471fd Revert "broadband-modem-qmi: disable profile changed indications during our operations"
This reverts commit dad3e82747.

Disabling profile change indications just before doing our profile
updates and re-enabling them just after is not enough. The modem may
still emit the profile change indication right after, so all this
logic is unnecessary.
2023-03-22 17:42:28 +00:00
Aleksander Morgado 0ced39268d base-manager: improve logging of manager DBus requests 2023-03-21 10:06:00 +00:00
Aleksander Morgado 6058d3ded6 ci: test build without deprecated symbols support 2023-03-15 09:19:50 +00:00
Aleksander Morgado 5dbf8fdb47 iface-modem-signal: remove unused variable
src/mm-iface-modem-signal.c:99:27: warning: unused variable 'current_time' [-Wunused-variable]
      g_autoptr(GDateTime)  current_time = NULL;
                            ^
2023-03-15 09:07:15 +00:00
Aleksander Morgado 6c2822167b sim-mbim: remove unused variable
src/mm-sim-mbim.c:1134:30: warning: unused variable 'request' [-Wunused-variable]
      g_autoptr(MbimMessage)   request = NULL;
                               ^
2023-03-15 09:03:56 +00:00
Aleksander Morgado dad3e82747 broadband-modem-qmi: disable profile changed indications during our operations
Just ignoring the received indications is not enough, because they
could arrive after the operation response has been processed.

We now explicitly disable the indications by reconfiguring the modem
before and after every profile update operation triggered by our own
logic.
2023-03-10 10:59:42 +00:00
Aleksander Morgado 4903a1ed74 cli: remove unneeded EOLs when printing PCOs
E.g. in the key-value output:
  modem.3gpp.pco.length   : 2
  modem.3gpp.pco.value[1] : session-id: 1, complete: yes, data: 270180\n
  modem.3gpp.pco.value[2] : session-id: 2, complete: yes, data: 271480802110030100108106503A3DFA8306503A3DFE\n

Or in the human output:
  ----------------------------------
  3GPP     |
           |                    pco: 1: (complete) '270180'

           |                         2: (complete) '271480802110030100108106503A3DFA8306503A3DFE'

  ----------------------------------
  3GPP EPS |   ue mode of operation: csps-2
2023-03-07 11:33:18 +00:00
Aleksander Morgado dee307d2cf base-manager: remove shadowing variable
[1/2] Compiling C object src/ModemManager.p/mm-base-manager.c.o
  ../src/mm-base-manager.c: In function ‘remove_device_inhibition’:
  ../src/mm-base-manager.c:1127:20: warning: declaration of ‘l’ shadows a previous local [-Wshadow]
   1127 |             GList *l;
        |                    ^
  ../src/mm-base-manager.c:1116:16: note: shadowed declaration is here
   1116 |         GList *l;
        |                ^
2023-02-24 13:43:34 +00:00
Aleksander Morgado 5cda24111b build: unstable release version bump to 1.21.4 2023-02-23 11:09:48 +00:00
Aleksander Morgado fbd79a278b xmm: fix crash parsing XACT? response
Ensure we don't assert when processing an unexpected response.

We were not correctly handling the case where g_match_info_matches()
was not succeeding.

  0x00007d8be96cc462 (libc.so.6 + 0x00028462)     abort
  0x00007d8be995ff01 (libglib-2.0.so.0 - gtestutils.c: 3253)      g_assertion_message
  0x00007d8be995ff64 (libglib-2.0.so.0 - gtestutils.c: 3279)      g_assertion_message_expr
  0x00007d8be858086a (libmm-shared-xmm.so - mm-modem-helpers-xmm.c: 467)  mm_xmm_parse_xact_query_response
  0x00007d8be857d4e0 (libmm-shared-xmm.so - mm-shared-xmm.c: 310) xact_query_bands_ready
  0x00007d8be9a79463 (libgio-2.0.so.0 - gsimpleasyncresult.c: 802)        g_simple_async_result_complete
  0x00005c8d2a11e9b9 (ModemManager - mm-base-modem-at.c: 538)     at_command_ready
  0x00007d8be9a79463 (libgio-2.0.so.0 - gsimpleasyncresult.c: 802)        g_simple_async_result_complete
  0x00005c8d2a19376b (ModemManager - mm-port-serial-at.c) serial_command_ready
  0x00007d8be9a79463 (libgio-2.0.so.0 - gsimpleasyncresult.c: 802)        g_simple_async_result_complete
  0x00005c8d2a18f93f (ModemManager - mm-port-serial.c: 139)       command_context_complete_and_free
  0x00005c8d2a192985 (ModemManager - mm-port-serial.c: 753)       port_serial_got_response
  0x00005c8d2a192dff (ModemManager - mm-port-serial.c: 924)       common_input_available
  0x00007d8be993e3fc (libglib-2.0.so.0 - gmain.c: 3417)   g_main_context_dispatch
  0x00007d8be993e704 (libglib-2.0.so.0 - gmain.c: 4211)   g_main_context_iterate
  0x00007d8be993e978 (libglib-2.0.so.0 - gmain.c: 4411)   g_main_loop_run
  0x00005c8d2a105e66 (ModemManager - main.c: 217) main
  0x00007d8be96cc6c5 (libc.so.6 + 0x000286c5)     __libc_init_first
  0x00007d8be96cc781 (libc.so.6 + 0x00028781)     __libc_start_main
  0x00005c8d2a105b80 (ModemManager + 0x00061b80)  _start
2023-02-21 14:59:01 +00:00
Aleksander Morgado 7837944e25 base-manager: fix crash when uninhibiting partially removed device
If the device is not fully removed from the system during inhibition
and port additions happen, we reach a state where the MMDevice object
is still tracked by ModemManager and we also have new port additions
tracked that will require explicit port probings before a new modem
object can be created.

Solve this mixup by faking the removal of all existing device ports,
which will end up completely removing hte MMDevice, so that new port
additions reported afterwards also involve the full device probing
process triggered by the plugin manager.

The issue could be reproduced easily on a MBIM device that also
exposed TTYs, as follows:

 * mmcli -m a --inhibit, leave it running
 * rmmod cdc_mbim && sleep 5 && modprobe cdc_mbim (so that the
   cdc-wdm and net ports go away from the system but NOT the TTYs.)
 * Cltr+C to stop the inhibit in the mmcli call.

ModemManager would assert as follows:

  0x000079918bcf2a3f (libc.so.6 + 0x00087a3f)     pthread_key_delete
  0x000079918bca7c6c (libc.so.6 + 0x0003cc6c)     gsignal
  0x000079918bc93462 (libc.so.6 + 0x00028462)     abort
  0x000079918bf26f03 (libglib-2.0.so.0 - gtestutils.c: 3253)      g_assertion_message
  0x000079918bf26f66 (libglib-2.0.so.0 - gtestutils.c: 3279)      g_assertion_message_expr
  0x0000594ff1093d0c (ModemManager - mm-base-manager.c: 1110)     remove_device_inhibition
  0x0000594ff1093968 (ModemManager - mm-base-manager.c: 1247)     inhibit_device_auth_ready
  0x000079918c0536a8 (libgio-2.0.so.0 - gtask.c: 1230)    g_task_return_now
  0x000079918c0536db (libgio-2.0.so.0 - gtask.c: 1244)    complete_in_idle_cb
  0x000079918bf053fc (libglib-2.0.so.0 - gmain.c: 3417)   g_main_context_dispatch
  0x000079918bf05704 (libglib-2.0.so.0 - gmain.c: 4211)   g_main_context_iterate
  0x000079918bf05978 (libglib-2.0.so.0 - gmain.c: 4411)   g_main_loop_run
  0x0000594ff108de66 (ModemManager - main.c: 217) main
  0x000079918bc936c5 (libc.so.6 + 0x000286c5)     __libc_init_first
  0x000079918bc93781 (libc.so.6 + 0x00028781)     __libc_start_main
  0x0000594ff108db80 (ModemManager + 0x00061b80)  _start
2023-02-21 14:35:18 +00:00