Commit Graph

138 Commits

Author SHA1 Message Date
John Audia
35209ac249 modemmanager: change permissions on dbus file
/etc/dbus-1/system.d/org.freedesktop.ModemManager1.conf needs to be 644
so that it can be read to prevent the following since dbus runs as an
unprivileged user:

dbus-daemon[12465]: Encountered error 'Failed to open "/etc/dbus-1/system.d/org.freedesktop.ModemManager1.conf": Permission denied' while parsing '/etc/dbus-1/system.d/org.freedesktop.ModemManager1.conf

Build system: x86/64
Build-tested: x86/64-glibc
Run-tested: x86/64-glibc

Signed-off-by: John Audia <therealgraysky@proton.me>
2025-08-02 14:26:21 +02:00
Christian Korber
a6b332f4e9 modemmanager: change to configuration option disable_modem
This commit sets default of `disable_modem` to 1 and disconnects modem.
If set otherwise it keeps the modem connected.

Signed-off-by: Christian Korber <ck@dev.tdt.de>
2025-07-08 07:55:17 +02:00
Ryan Press
7efed7ff9f modemmanager: add sourcefilter option support
This make source based IPv6 routing option available for
modemmanager when using modem SLAAC.

Signed-off-by: Ryan Press <ryan@presslab.us>
2025-05-28 08:16:27 +02:00
Florian Eckert
d221309637 modemmanager: backport fixes for version 1.24.0
The following commits were added shortly after the release of Modemmanager
version '1.24.0'.

Patch: 0002-modem-helpers-cinterion-allow-spaces-in-SXRAT-test-r.patch
Backport: 6b6997362b
Issue: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/974

Patch: 0003-modem-helpers-fix-checking-of-CDMA-EVDO-access-techn.patch
Backport: 9e205f4784
Issue: no

Patch: 0004-iface-modem-voice-recheck-call-state-polling-when-ca.patch
Backport: 92e666e1c9
Issue: no

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-05-15 14:33:22 +02:00
Daniel Golle
29a6674cb5 modemmanager: backport commit fixing crash with Fibocom mtk-7xx modems
Backport commit
046b79a676

See also
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/975

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2025-04-23 15:11:06 +02:00
Ryan Press
939939bcee modemmanager: bump to 1.24.0
100-ublox-remove-ID_MM_PROCESS-tags.patch has been removed as this change is now upstream.

Signed-off-by: Ryan Press <ryan@presslab.us>
2025-04-18 18:00:40 +02:00
Florian Eckert
6b9b6fdace modemmanager: add missing any option to allowedmode
The 'mmcli' also understands the option 'any'.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-04-10 09:33:58 +02:00
Florian Eckert
6c8ad9f02b modemmanager: fix pending mmcli calls for ModemManager-monitor script
If the ModemManager is stopped via '/etc/init.d/modemmanager', mmcli calls
always remain in the process list. This is because the ModemManager-monitor
call is not terminated properly, as the kill signals are not handled
correctly in the startup script for mmcli.

To fix this, the signal handling is refactored.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-04-01 10:08:27 +02:00
Florian Eckert
5c203c36d5 modemmanager: add missing mmcli timeout option during ubus call
The default 'timeout' value is 30 seconds when calling an mmcli action. That
is too long. For this reason, the mmcli 'timeout' option is specified for
calls and the value is set to 10 seconds.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-04-01 10:08:27 +02:00
Gilles Lenaerts
5cb12d479b modemmanager: add config optional netifd integration
This change introduces an optional configuration
of the  netifd integration in the ModemManager package.
When disabled, it removes the NETIFD dependency and
other unwanted components from the root filesystem
during the build phase.

Additionally, in the modemmanager.common the netifd-proto.sh
inclusion line can be savely removed as there is no usage
of it in its functions.

Signed-off-by: Gilles Lenaerts <gilles.lenaerts_ext@softathome.com>
2025-02-26 10:03:30 +01:00
Florian Eckert
434c353e62 modemmanager: do not disable modem on reconnect
If the modem loses the connection, an attempt is made to re-establish the
connection via the report-down script.

Until now, the modem was disabled when the modem processed the teardown of
the modemmanager protohandler. The immediate up events of netifd renables
the modem right away. This takes time, which is not necessary.

This commit changes the behavior so that the modem is not disabled when
the modemmanager is disconnected via the report-down script.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-02-12 16:52:16 +01:00
Florian Eckert
2ecfcce324 modemmanager: bump PKG_RELEASE
Bump PKG_RELEASE by one.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert
24d2ba0ba8 modemmanager: check during SIM unlocking whether initialization has been completed
After the SIM has been successfully unlocked, it is initialized. This can
take longer on some modems, so we must wait until the modem is ready to
execute the next commands.

Otherwise the modem cannot be enabled and aborts with the following
error message:

error: couldn't enable the modem: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.WrongState: modem in initializing state'

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert
fa6198e36b modemmanager: reset to 'no' plmn if nothing is configured
If a configured 'plmn' is deleted from the configuration between a connection
setup, it will continue to be used because the modem remembers it.

Therefore, the 'plmn' stored in the modem must be deleted when a new
connection is established if it is no longer in the configuration.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert
3a5aa8a387 modemmanager: swap plmn and technology set command in the proto
In the current implementation of the modemmanager 'proto', if a 'plmn' and a
'technology' is configured, the 'plmn' is set first and then second the
'technology' on a 'proto' setup.

However, this is problematic if a 'technology' has already been set in an
earlier run. It is possible, that this previously set 'technology' is not
available at the current location, as the modem remembers the setting.

To fix this, first set the technology and then the plmn.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert
8682084e34 modemmanager: move plmn registration into own function
To improve the code, the setting of the 'plmn' is moved to separate function.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert
5ab483aa44 modemmanager: rename function modemmanager_check_state to modemmanager_check_sim_state
This is a preparation commit for a new function.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert
9f35173639 modemmanager: move initial eps settings after modem enable
This settings are needed before any other mmcli command is executed.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert
b6664ae938 modemmanager: add log file if syslog is set to DEBUG
If the ModemManager is started with debug, all outputs are written to the
system log. To simplify debugging, a logging file is now created under
'/var/log/mm.log' in this case. This simplifies error analysis.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert
dd2e7105e6 modemmanger: bump PKG_RELEASE number
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert
85a01e2bb3 modemmanager: add pin check attempts
This new check in the proto modemanager prevents the SIM card from being
blocked and therefore PUK is not required. If the PIN is entered incorrectly
in the 'uci' configuration, it makes no sense to try this several times
until the PUK is required. Should it nevertheless happen that the PUK
is required, then this will logged.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert
deaef51d07 modemmanager: improvement of readability by reversing the query
No functional change. The change makes reading the source clearer.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert
cdda998996 modemmanager: add missing interface argument to function modemmanager_check_state
The variable interface is used in the sub-function 'modemmanager_check_state'.
However, this is not an argument of the function and so the global value
is used. Addding the variable as an function call argument fixes this.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert
64bd9e9d08 modemmanager: move modemmanager_check_state failed and locked into sub functions
To make the source clearer, the program parts for the 'locked' and 'failed'
cases are outsourced to sub-functions.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert
dced576bfe modemmanager: fix value call with modemmanager_get_field function
The correct values are prefixed with 'modem.generic'. This is missing
for the value 'state' and 'state-failed-reason.

While we're at it, let's move the readout of 'state-failed-reason' to the
failed case, because that's the only place it's needed.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert
e2822c9d80 modemmanager: extend log message with count on boot
This makes debugging at system startup easier and shows how long we are
waiting for the ModemManager to start.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Christian Svensson
f48f15a899 modemmanager: make rpcd integration optional
ModemManager does not depend on Lua by its own, so make it possible to
not have a requirement on Lua if the rpcd integration is not needed.

Signed-off-by: Christian Svensson <blue@cmd.nu>
2024-08-07 15:27:33 +02:00
Florian Eckert
9de61ea058 modemmanager: add missing ubus status backend via mmcli
The 'modemmanager' uses the 'dbus'. Status information can be retrieved
with the 'mmcli' command, this can also be output in json format.

This commit adds a new 'ubus' backend with which this information can
be easily accessed via ubus.

* ubus call modemmanager info
* ubus call modemmanager dump

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-07-10 12:26:51 +02:00
Chen Minqiang
9877676890 modemmanager: add sourcefilter option support
This make source based IPv6 routing option available for
modemmanager case dhcpv6

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2024-06-23 16:39:01 -07:00
Oliver Sedlbauer
7eb763b962 modemmanager: remove status message from errors
The message 'MM_CONNECT_IN_PROGRESS' is a status message, not an error
message. To avoid confusion, the message has been removed.

Signed-off-by: Oliver Sedlbauer <osedlbauer@tdt.de>
2024-06-11 16:00:20 +02:00
Oliver Sedlbauer
06a6258035 modemmanager: add option to force connection
This commit improves the automatic reconnect logic. If the modem cannot
establish a connection, for example due to poor reception, the
proto_block_restart prevents the interface from trying to reconnect.
To enforce the connection, this commit adds a new option that allows the
system to attempt to establish a connection indefinitely.

Signed-off-by: Oliver Sedlbauer <osedlbauer@tdt.de>
2024-06-11 15:59:45 +02:00
Robert Marko
9cce31c309 treewide: fix incorrect hashes
It seems that PR #24113 introduced incorrect hashes for multiple packages.

So, lets fix all of them at once.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-24 13:50:11 +08:00
Florian Eckert
35f1bed3fb modemmanager: fix PKG_MIRROR_HASH
Due to the change in the version description, the package must be
downloaded again. In addition, the standard compression method has changed
to zst. The checksum must therefore be recalculated.

Fixes: 22f8fd5c5b ("modemmanager: add missing PKG_VERSION for APK")
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-05-10 14:18:04 +02:00
Florian Eckert
22f8fd5c5b modemmanager: add missing PKG_VERSION for APK
The 'PKG_VERSION' string was missing and only 'PKG_SOURCE_VERSION' string
was used.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-04-23 09:39:32 +02:00
Robert Marko
272f55e87f treewide: refresh hashes after move to use ZSTD as default
With the recent move to using ZSTD as the default compression format
for packaging git repo clones we must refresh all of the hashes for
the packages feed as well.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-04-07 12:06:34 +02:00
Florian Eckert
26117ac9b1 Merge pull request #23590 from TDT-AG/pr/20240305-modemmanager
modemmanager: reconnect interface if the modemmanager detects a disconnect
2024-03-12 11:59:11 +01:00
Daniele Palmas
c51a804a63 modemmanager: report events for virtual netdevices
Virtual netdevices created for multiplexing should not be skipped
when reporting events, otherwise it is not possible to setup the
data connection.

Add these exceptions in mm_report_event function.

Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
2024-03-06 10:16:21 +01:00
Florian Eckert
77c16abb1a modemmanager: reconnect interface if the modemmanager detects a disconnect
There are situation for mobile routers, that the modemmanager can not
stay connected to the mobile network. There can have various reasons.
In order for the system to reconnect automatically, the netifd must be
informed that it must re-establish the connection.

The modem manager already does have a script callback handling which is
already used by the modemmanager in openwrt. Currently the modem is marked
as not unavailable when a disconnected event is detected.

The behavior was changed with this commit, so that a reconnect of the
interface is now triggerd via the netifd if the modem disconnects.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-03-06 09:11:57 +01:00
Florian Eckert
9d509b7433 modemmanager: start a 3gpp network regsistration
If a 'plmn' is set in the configuration, a registration attempt should be
established before the simple-connect command. If the plmn is set during
the simple-connect, a network change may occur during the connection setup.

To prevent this, the registration is started before the simple-connect with
a separate mmcli command. So that we can be sure that the modem is already
registered in the correct network before the simple-connect command.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-03-05 15:20:38 +01:00
Florian Eckert
d839e194c5 modemmanager: move cleanup and enable to the top
Before a new connection attempt is made, the previous connection must be
cleaned up before further connection attempts are made. This is now done
by moving the cleanup and enable sequence to the beginning of the
conection setup.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-03-05 15:20:38 +01:00
Florian Eckert
dab2cdc44c modemmanager: moving the openwrt related files to subdirectories
Moving the openwrt related files to subdirectories as they are installed
on the system. This change makes it immediately apparent during development
where the file is to be installed in the running system.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-03-05 13:04:59 +01:00
Florian Eckert
fabb50ae97 modemmanger: bump PKG_RELEASE
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-01-19 08:52:04 +01:00
Florian Eckert
b0f7260319 modemmanager: suppress mm_log debug messages by default
The log is filled with 'debug' messages. This is not necessary and is
only normaly needed during development. To suppress this message, check
whether the level is 'debug' and if so, suppress it. If this message is
required again, the message can be generated by commenting out this line.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-01-19 08:47:44 +01:00
Florian Eckert
d9b5e06d19 modemmanager: replace modem available check on start with the new monitore service
Before this change, the status of the sysfs paths from the kernel events
was cached with a cache file. This is necessary to mark configured modems
as available for the netifd.

Using the new monitor service via the mmcli command 'mmcli -M' simplifies
the whole process. There is no need to start sub shells in the background
anymore that monitors whether the modem has already been added to the
ModemManager.

For this purpose, a new service was added that reacts on add and remove
events for modems in the ModemManager and, if necessary, marks the logical
netifd interface as available.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-01-19 08:47:34 +01:00
Florian Eckert
ebc9038721 modemmanager: move shell include to the beginning of the file
It is usual that the includes are listed at the beginning of the script.
So let's do it that way too.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-01-19 08:46:37 +01:00
Florian Eckert
39e084ca6b modemmanager: move generally applicable functions to modemmanager.common
These moved functions are general functions. This is a preparatory
commit so that these moved functions can also be used in other
ModemManager scripts.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-01-19 08:43:35 +01:00
Florian Eckert
620afc1806 modemmanager: set allowedmode to 'any' if nothing is configured
The modem saves the permitted technology configuration in the modem
itself. If the technology configuration is deleted in the uci, this is
not passed on to the modem. This means that the previously saved
technology configuration is remains in the modem and is therefore still
active. By setting the technology to 'any', if no option is set, all
technologies are allowed again.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-01-19 08:31:17 +01:00
Florian Eckert
af12147f8c modemmanager: add possibilty for setting initial EPS bearer
If no GSM but only 4G is available and a special APN must be used, it
is necessary to set an inital EPS bearer beforehand. If this is not set,
then modem cannot log in and register in the mobile network.

The new option 'init_epsbearer' could be set to the following options.
* none: No init EPS bearer is used and the old one is deleted (default)
* default: Use init EPS bearer with the following config options
  'iptype', 'allowedauth', 'password', 'user' and 'apn' as for the
  connection bearer.
* custom: Other parameters are used that do not match those of the
  default connection bearer. These have an 'init_' prefix and are named
  in the same way as the default connection bearer config options.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-12-04 12:14:56 +01:00
Florian Eckert
7b4d82c58f modemmanager: check modem state before establishing a connection
With this change the following modem 'state' are checked before a
connection attempt setup.
* failed: Stop connection attempt because of sim-missing
* locked: Stop connection attempt if no pincode is set

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-12-04 11:37:06 +01:00
Oliver Sedlbauer
074741e343 modemmanager: move iface cleanup to wrapper script
If the ModemManager process crashes, the interfaces are not cleaned
up properly because the stop_service method is not called. With this
change, the interfaces are cleaned up both when stopping the service
and during a crash. Therefore it is no longer necessary to perform a
cleanup at the beginning.

Signed-off-by: Oliver Sedlbauer <osedlbauer@tdt.de>
2023-10-30 08:53:29 +01:00