Commit Graph
3966 Commits
Author SHA1 Message Date
Aleksander Morgado b766ded3ca iface-modem-time: fix invalid read when loading network timezone fails
==226546== Invalid read of size 4
  ==226546==    at 0x5068CB7: g_error_matches (in /usr/lib/libglib-2.0.so.0.6600.7)
  ==226546==    by 0x1BAC86: load_network_timezone_ready (mm-iface-modem-time.c:218)
  ==226546==    by 0x4EA827E: g_simple_async_result_complete (in /usr/lib/libgio-2.0.so.0.6600.7)
  ==226546==    by 0x17AE2C: at_command_ready (mm-base-modem-at.c:538)
  ==226546==    by 0x4EA827E: g_simple_async_result_complete (in /usr/lib/libgio-2.0.so.0.6600.7)
  ==226546==    by 0x24B475: serial_command_ready (mm-port-serial-at.c:378)
  ==226546==    by 0x4EA827E: g_simple_async_result_complete (in /usr/lib/libgio-2.0.so.0.6600.7)
  ==226546==    by 0x244F94: command_context_complete_and_free (mm-port-serial.c:141)
  ==226546==    by 0x246861: port_serial_got_response (mm-port-serial.c:755)
  ==226546==    by 0x246923: port_serial_timed_out (mm-port-serial.c:785)
  ==226546==    by 0x50863C3: ??? (in /usr/lib/libglib-2.0.so.0.6600.7)
  ==226546==    by 0x5085B83: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.6600.7)
2021-04-09 00:55:56 +02:00
Aleksander Morgado 83a00a9457 modem-helpers: new helper to lookup range from CGDCONT=? response 2021-04-08 10:04:42 +00:00
Aleksander Morgado 7e0404c6c2 modem-helpers-qmi: match QMI_WDS_AUTHENTICATION_NONE with MM_BEARER_ALLOWED_AUTH_NONE
There is no point in returning UNKNOWN when the WDS auth value is NONE.
2021-04-08 10:04:42 +00:00
Aleksander Morgado e9ee6dfdb8 broadband-modem-qmi: remove unused variables 2021-04-08 10:04:42 +00:00
Aleksander Morgado 1db0f0b66f iface-modem-simple: add multiplex info in connection details logging 2021-04-02 15:05:02 +02:00
Aleksander Morgado c3fdaca4c8 iface-modem-simple: minor renames in logging of connection details 2021-04-02 15:05:02 +02:00
Aleksander Morgado e6a04c0703 iface-modem-3gpp-ussd: use common method to abort invocation if not enabled 2021-04-02 15:05:02 +02:00
Aleksander Morgado 7dfe6198e1 iface-modem: publish helper to abort invocation if state not reached
So that we can use it in other interfaces to abort invocations e.g. if
the modem is not yet enabled.
2021-04-02 15:05:02 +02:00
Aleksander Morgado cc59492caf base-bearer: add autoptr setup for MMBearerConnectResult 2021-04-02 15:05:02 +02:00
Aleksander Morgado 851a708442 modem-helpers: ip family normalization doesn't need log_object 2021-04-01 11:24:42 +02:00
Aleksander Morgado 2c27a7aadc base-bearer: remove default IP family property
There is no point in providing a configurable default IP family in the
bearer object, because we can always assume IPv4 as being the only
default expected.

Simplify the logic and also provide a new method to get the normalize
the IP family, using IPv4 as default always.
2021-03-31 23:46:31 +02:00
Pavan Holla 250c09b73c shared-qmi: Fix crash when a hotswap occurs while loading slots 2021-03-31 15:56:44 +00:00
Aleksander Morgado 7b141a6715 port-serial: remove misleading comments 2021-03-31 13:55:52 +02:00
Aleksander Morgado c456027563 port-serial: the 'FlashOk' property is not really set on construct 2021-03-31 13:55:52 +02:00
Aleksander Morgado 9f7bbf28d2 iface-modem: avoid check for SIM swap if no interface skeleton available 2021-03-24 21:53:45 +01:00
Aleksander Morgado 96d83392a8 iface-modem: avoid lock info update if no interface skeleton available
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/351
2021-03-24 21:53:45 +01:00
Aleksander Morgado d6a724c7b3 broadband-modem: don't warn enabling/disabling USSD failures
USSD is a feature interface, not critical for connection management,
so skip warning on interface enabling/disabling failures.
2021-03-24 11:56:08 +01:00
Andrew Lassalle dbb3825984 kernel-device-helpers: Remove unused variable 2021-03-18 17:10:54 -07:00
Aleksander Morgado ab007a4496 base-modem: plug leaks when organizing ports
The GLists maintained in the logic need to be explicitly freed (just
the lists, not the list contents) if we exit early on error or if we
end up deciding that the specific ports are available but unsupported
by the plugin (e.g. if a plugin that doesn't support net ports finds
net ports in the modem).

  ==225333== 24 bytes in 1 blocks are definitely lost in loss record 2,024 of 5,525
  ==225333==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
  ==225333==    by 0x506C539: g_malloc (in /usr/lib/libglib-2.0.so.0.6600.7)
  ==225333==    by 0x508DC8F: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.6600.7)
  ==225333==    by 0x50636B4: g_list_append (in /usr/lib/libglib-2.0.so.0.6600.7)
  ==225333==    by 0x17E671: mm_base_modem_organize_ports (mm-base-modem.c:1298)
  ==225333==    by 0x1E4409: mm_plugin_create_modem (mm-plugin.c:1094)
  ==225333==    by 0x162C81: mm_device_create_modem (mm-device.c:481)
  ==225333==    by 0x15DE60: device_support_check_ready (mm-base-manager.c:218)
  ==225333==    by 0x4EA8173: ??? (in /usr/lib/libgio-2.0.so.0.6600.7)
  ==225333==    by 0x4EAC6E8: ??? (in /usr/lib/libgio-2.0.so.0.6600.7)
  ==225333==    by 0x16730F: device_context_run_ready (mm-plugin-manager.c:1533)
  ==225333==    by 0x4EA8173: ??? (in /usr/lib/libgio-2.0.so.0.6600.7)
2021-03-18 14:27:34 +01:00
Aleksander Morgado 3e58fbe547 base-bearer: ignore forced disconnections
If using PPP, ModemManager is never in charge of deciding when the
connection is finished, because that would end up making ModemManager
try to use the TTY port while pppd is still using it.

When the modem goes unregistered for some time, we should not force
the disconnection of the bearer object, we still need to wait for pppd
to tell us the modem is disconnected.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/331
2021-03-17 09:19:17 +00:00
Aleksander Morgado 952f416577 bearer-mbim: if no explicit 'multiplex' setting, treat as 'requested' 2021-03-17 09:39:10 +01:00
Aleksander Morgado 8f3df02ba1 broadband-modem-mbim: report up to 256 multiplexed bearers
As defined in the MBIM protocol (session id 0 to 255).
2021-03-17 09:39:10 +01:00
Aleksander Morgado 2d374b1c41 bearer-mbim: implement multiplex support 2021-03-17 09:39:10 +01:00
Aleksander Morgado 32c4b20066 port-mbim: implement new link setup/cleanup methods
These are really wrappers around the MbimDevice methods, only making
sure the MMPortMbim is open before they're used.
2021-03-17 09:39:10 +01:00
Aleksander Morgado e5305498b7 bearer-mbim: session id 0 by default in all non-multiplexed connections
The original logic in the MBIM modem would assume that if we had more
than one network interface in the same modem, we could connect
multiple data interfaces, each one with a different session. That
logic is actually wrong, when using the master (non-multiplexed)
network interface we should always use session id 0, which is the one
holding all non-VLAN-tagged traffic.

So, remove the logic that automatically creates new bearers with a
different session id, as that is really wrong.
2021-03-17 09:39:10 +01:00
Aleksander Morgado 0830f9510c bearer-mbim: refactor and switch to autoptr
Also, keep track of the MMPortMbim instead of the MbimDevice directly,
because the new multiplex support will require operations on the port
as well, not only on the device.
2021-03-17 09:39:10 +01:00
Aleksander Morgado 1fa8ce3f08 broadband-modem-mbim: reset all net ports during initialization
We want to start with the data ports as clean as possible when the
modem is initialized, so we make sure the master interface is down and
that all links found are removed. This ensures a clean restart if
e.g. the daemon crashes for some other reason.
2021-03-17 09:39:10 +01:00
Aleksander Morgado 37d4f5c129 port-mbim: implement port reset logic 2021-03-17 09:36:53 +01:00
Eric Caruso c7b1ee9c94 mm-base-manager: split assertion
This allows us to know which of the subsystem or name for a
removed device is triggering the assertion from just a stack
trace that contains line information.
2021-03-16 11:39:15 -07:00
Aleksander Morgado fdfd4b270a shared-qmi: acquisition order preference TLV always same items
The acquisition order preference TLV must always have the same number
of elements, just the order of the elements should be different.

Also, always prefer the acquisition order preference TLV to the
GSM+WCDMA specific one, which is the same logic the modem applies.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/340
2021-03-15 17:46:49 +01:00
Aleksander Morgado bb5bc9c8c5 shared-qmi: process all feature checks in SSP response together
Loading capabilities is the very first step of the state machines, and
so we can rely on the "NAS Get SSP" method performed there to process
all feature checks of the SSP response.
2021-03-15 17:46:41 +01:00
Aleksander Morgado 65a7624ffd shared-qmi: if getting TP/SSP fails, assume unsupported
Until now we were only considering TP/SSP unsupported if we received
a QMI protocol error (e.g. reporting unknown command).

We now also consider TP/SSP unsupported if the actual request
succeeds, but an error is reported in the response. There is no point
in considering TP/SSP supported if the plain get request without input
TLVs given fails.
2021-03-15 17:21:50 +01:00
Aleksander Morgado 1a5f90f15b shared-qmi: add missing feature check flag initialization to UNKNOWN 2021-03-15 17:21:50 +01:00
Aleksander Morgado 67b64eb7ee shared-qmi: rename feature check variables
We want the "extended_lte_band_preference" with the "nas_ssp" prefix,
as we're going to add more checks for SSP features.
2021-03-15 14:58:54 +01:00
Madhav 830230dccb broadband-modem-qmi: retrieve operator name from plmn_name based on current operator id.
Retrieve operator name from plmn_name based on current operator id.
If service name is available, use service name as operator name.
If not, use the long or short name.
2021-03-14 15:23:55 +01:00
Aleksander Morgado e0a6d5d76b base-sim: allow disabling CPOL based preferred networks features 2021-03-12 12:41:35 +01:00
Teijo Kinnunen 74599e695b sim-qmi,libmm-glib: QMI implementation of get/set preferred networks 2021-03-12 10:42:37 +02:00
Teijo Kinnunen 82a9f16fa4 base-sim: select the desired format for loading preferred networks
Before invoking AT+CPOL? for loading preferred networks list from
SIM, AT+CPOL=,2 is executed to make sure that the returned
operator codes are in expected (numeric) format.
2021-03-12 09:32:35 +02:00
Aleksander Morgado fdfcd30308 bearer-qmi: avoid increasing self reference during dispose()
The reset_bearer_connection() method is called during dispose, and if
a link had been created during the connection attempt, we would be
increasing the reference to the bearer object during dispose(), which
should never happen.

Just avoid passing any callback to the cleanup_link() method, as we
really were using that only for logging purposes.
2021-03-11 11:38:29 +01:00
Aleksander Morgado a772b70632 bearer-mbim: plug MbimDevice leak in disconnection context 2021-03-11 10:33:00 +01:00
Aleksander Morgado bd075aeba0 bearer-qmi: if no explicit 'multiplex' setting, default to 'requested' 2021-03-10 15:18:00 +01:00
Aleksander Morgado 0b72d9b566 port-qmi: flag multiplexing as unsupported in BAM-DMUX
In BAM-DMUX based setups we already have multiple network interfaces
exposed in the system, which we bind to using the SIO port number.

So, disable QMAP multiplexing in this case, to simplify the setup and
avoid attempting to create additional net links when connecting
multiple bearers.
2021-03-10 15:18:00 +01:00
Aleksander Morgado 791c7908e4 port-qmi: initialize net port driver information early
The MMPortQmi may need to know very early what kind of net ports are
going to be used later on during connection, e.g. to decide what kind
of multiplexing capabilities are available and such.

So, once we have organized ports in the modem, we'll take the driver
of the first network port in the list of data ports, and pass it down
to all QMI ports setup in the modem object.
2021-03-10 15:18:00 +01:00
Aleksander Morgado 4f4ce02c43 port-qmi: compute max amount of multiplexed links supported
For the qmi_wwan driver, we have imposed a limitation of max 4 links
when using the add_mux/del_mux interface, because we're forced to
precreate links before multiplexing may be enabled.

When using rmnet over qmi_wwan, or rmnet over other drivers, we don't
have any limitation other than the one imposed by the WDA protocol
itself. The amount of links that may be created in this case is
1 + (QMI_DEVICE_MUX_ID_MAX - QMI_DEVICE_MUX_ID_MIN).

This information is loaded in the MMPortQmi, used to create the
MMBearerList in the QMI modem, and finally populated in the
'MaxActiveMultiplexedBearers' property of the modem interface.
2021-03-10 15:17:59 +01:00
Aleksander Morgado 499d954857 port-qmi: setup master MTU link to max aggregation data size
This step is required when using the qmi_wwan add_mux/del_mux logic,
and must be done before changing the kernel data format to raw-ip.
2021-03-10 15:17:59 +01:00
Aleksander Morgado b0f26a1f0b bearer-qmi: bring master interface up on connection attempt
The user of the ModemManager API will bring up the data network
interface exposed in the Bearer IP settings (i.e. the link interface
when using multiplexing). But for instantiated network links, we also
need to have the master interface brought up before any traffic can go
through the link interface.

We don't check whether the master interface is already up before
attempting to bring it up, we just attempt to bring it up.
2021-03-10 12:58:12 +01:00
Aleksander Morgado 1643c3d3db bearer-qmi: create data port link if multiplex is requested/required
If the user requests or requires to use multiplexing support, try to
create a data port link and bind the WDS client(s) to it.

If the multiplex is requested but not required, we allow link creation
failures or setups where multiplexing isn't supported; we just go on
with the default connection setup without multiplexing, as long as
there is no bearer connected on the same data network interface.

If the multiplex is required and for any reason it cannot be fully
setup, we will fail the connection attempt right away.

The data port link is created in the system via the QmiDevice in the
open MMPortQmi, but it MUST be notified by the kernel (e.g. via udev
or via kernel events) before the connection attempt goes on.
2021-03-10 12:58:12 +01:00
Aleksander Morgado db5cb302c9 port-qmi: don't allow switching to non-multiplexed mode if links exist
If the port has net links that have been setup, don't allow switching
it from multiplexing mode to non-multiplexing mode.
2021-03-10 12:58:12 +01:00
Aleksander Morgado f58d3ef93f port-qmi: new methods to setup/cleanup net links
The logic to setup/cleanup net links is based on the QmiDevice net
link addition/removal operations.

When the qmi_wwan add_mux/del_mux based logic is in use, we default to
precreate 4 net links and we limit the amount of bearers that may be
connected to that maximum, because it is not guaranteed that the
qmi_wwan driver is able to create new links once the master interface
is up; and the master interface needs to be up for a proper data
connection.

For all other drivers, or when qmi_wwan uses qmap-pass-through, we
allow adding/deleting new links at any moment, without needing to rely
on the precreated ones.
2021-03-10 12:58:12 +01:00
Aleksander Morgado b3fb87cdf6 base-modem: new method to wait for an explicit link port
When new link ports are created, the QmiDevice link management methods
try to make sure that the port exists in the system by the time the
link addition method returns, but that doesn't guarantee that the port
has also been notified by the kernel to ModemManager (e.g. via udev or
via kernel events).

This new method allows to do a explicit wait for a given port link; if
we already have it it will return right away, and otherwise we'll wait
for it to be notified via the "link port grabbed" signal.
2021-03-10 12:58:12 +01:00