Commit Graph

106 Commits

Author SHA1 Message Date
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
Oliver Sedlbauer d78505bcfa modemmanager: improve cleanup of ifaces
Change workflow to cleanup interfaces using the sysfscache.
The sysfscache stores the processed sysfs-paths. Using this
instead of mmcli -L, the interfaces can be properly cleaned
up even if, for example, ModemManager crashes and mmcli is
no longer usable.

Signed-off-by: Oliver Sedlbauer <osedlbauer@tdt.de>
2023-10-30 08:53:10 +01:00
Oliver Sedlbauer 01fb59f4e2 modemmanager: check status of report-kernel-event
At mm_report_modem_wait a wait status is set. When attempting to report
an event (via hotplug or during startup) and the DBus is not yet available,
the status in the sysfs cache is set to 'processed' incorrectly, even
if mmcli fails.
This is fixed by aborting the operation and logging an error when
the kernel report fails.

Signed-off-by: Oliver Sedlbauer <osedlbauer@tdt.de>
2023-10-25 09:33:22 +02:00
Oliver Sedlbauer 9ae43c14e8 modemmanager: remove sysfscache after dbus ready
The mm_report_events_from_cache method is called during the startup and
informs the ModemManager of kernel events. Additionally, hotplug scripts
inform the ModemManager of kernel events. Processed events are stored in
the sysfs cache. It is possible for a hotplug script to write to the
sysfs cache while the mm_report_events_from_cache method is still waiting
for the ModemManager to be available on the bus during startup.
This could lead to a misbehavior where modems are not recognized.
To ensure a clean state on startup, the sysfs cache is cleared after the
ModemManager is available, ensuring reliable processing of kernel events.

Signed-off-by: Oliver Sedlbauer <osedlbauer@tdt.de>
2023-10-25 09:33:22 +02:00
Maxim Anisimov 5a81a131b6 modemmanager: bump to 1.22.0
- switch to builtin plugins
- import upstream patch for fixing support of ublox LARA-R6001 / LARA-R6001D modules
  (see: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/779)

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
2023-10-18 07:35:44 +03:00
Florian Eckert 56111297af modemmanger: bump PKG_RELEASE
The PKG_RELEASE was not incremented during the last merge, the commit shows
that it is incremented by one, but this was already done during the last
change. Very strange. Hence this commit which increments PKG_RELEASE by
one.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-09-27 15:56:49 +02:00
Florian Eckert 5c63540762
Merge pull request #21993 from osedl/pr/20230901-modemmanager-hardcoded-proto
modemmanager: Remove hardcoded proto check
2023-09-27 13:39:02 +02:00
Florian Eckert d6ccb92551
Merge pull request #22055 from pprindeville/modem-manager-fix-no-mbim-install
modemmanager: handle no *.conf files being installed
2023-09-06 08:08:53 +02:00
Philip Prindeville aa03634cbc modemmanager: handle no *.conf files being installed
To begin with, there are only a couple of .conf files, and
one of them is for testing, and the other is only installed
when MBIM is enabled, so if you build without MBIM you'll
have a failing install:

  install -m0644 /home/pprindeville/work/openwrt/build_dir/target-x86_64_musl/modemmanager-1.20.6/ipkg-install/usr/share/ModemManager/*.conf /home/pprindeville/work/openwrt/build_dir/target-x86_64_musl/modemmanager-1.20.6/.pkgdir/modemmanager/usr/share/ModemManager
  install: cannot stat '/home/pprindeville/work/openwrt/build_dir/target-x86_64_musl/modemmanager-1.20.6/ipkg-install/usr/share/ModemManager/*.conf': No such file or directory
  make[2]: *** [Makefile:161: /home/pprindeville/work/openwrt/build_dir/target-x86_64_musl/modemmanager-1.20.6/.pkgdir/modemmanager.installed] Error 1
  make[2]: Leaving directory '/home/pprindeville/work/openwrt/feeds/packages/net/modemmanager'

So make sure there's anything there to copy over first.

Signed-off-by: Philip Prindeville <pprindeville@netgate.com>
2023-09-05 21:38:27 -06:00
Oliver Sedlbauer 29590e5d6d modemmanager: Remove hardcoded proto check
Modified the code to correctly determine modem availability based on the
sysfs path provided in the 'device' option, instead of relying  on the
'proto' value. This ensures proper configuration for custom-made protos
that do not match the "modemmanager" identifier.

Signed-off-by: Oliver Sedlbauer <osedlbauer@tdt.de>
2023-09-01 14:07:05 +02:00
Oliver Sedlbauer ac806e9921 modemmanager: Fix Permission Denied error
The proto_send_update function is sending a notification to netifd
during the teardown section. However, netifd filters link update
notifications executed during teardown, as indicated here:
https://git.openwrt.org/?p=project/netifd.git;a=blob;f=proto-shell.c#l515
This was leading to a Permission Denied error due to its behavior,
making proto_send_update ineffective during teardown.

To address the issue, the proto_send_update function has been removed
from the teardown section. This prevents the Permission Denied error
while ensuring proper operation during teardown.

Additionally, in the 10-report-down helper script, a check has been
implemented to determine if the interface is already down. This check
is crucial to avoid triggering a Permission Denied error, especially
in cases where netifd is already aware of a controlled ifdown operation.

Signed-off-by: Oliver Sedlbauer <osedlbauer@tdt.de>
2023-09-01 13:46:45 +02:00
Florian Eckert 161fd74fa2 modemmanager: copy dbus interfaces file to staging
In order to use the dbus interfaces via the command gdbus-codegen, the
xml files must be copied into the building staging directory, so that other
programmes can use them during compilation.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-08-18 13:31:19 +02:00
Florian Eckert 015106346c modemmanager: add setting for allowed and preferred mode
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-08-09 14:13:06 +02:00
Florian Eckert 5fa043000f modemmanager: remove unneeded teardown error reporting
Teardown error reporting is not needed, bacause it overrides init error
reporting.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-08-09 14:10:25 +02:00
Florian Eckert dbf23705c5 modemmanager: fix white spaces
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-08-09 14:10:20 +02:00
Florian Eckert 89391d4213 modemmanager: improve 'simple connection' option handling
The line to generate the argument list for 'simple connect' is quite
long and is not maintainable. To improve the handling a function
'append_param' was added for appending the 'simple connect' options.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-07-24 13:46:39 +02:00
Francisco Jose Alvarez 7ba2c969b2 modemmanager: Adding support for 'allow_roaming' option
Signed-off-by: Francisco Jose Alvarez <francisco.alvarez@galgus.net>
* Update commit head
* Rebase patch to the latest changes
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-07-24 12:57:39 +02:00
Florian Eckert 2f00e4b8d7 modemmanger: add missing proto_init_update in teardown
Inform netifd with missing 'proto_update', that the interface is not
up anymore.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-07-24 09:42:12 +02:00
Florian Eckert 30911865b2 modemmanager: do not set proto_notify_error on teardown
If on teardown the 'proto_notify_error' is set to 'MM_TEARDOWN_IN_PROGRESS',
then an error which is set on 'setup' is not visible in the ubus
network.interface.<iface> status output.

{
  "up": false,
  "pending": false,
  "available": true,
  "autostart": false,
  "dynamic": false,
  "proto": "modemmanager",
  "data": {
  },
  "errors": [
    {
      "subsystem": "dualsim",
      "code": "MM_TEARDOWN_IN_PROGRESS"
    }
  ]
}

It alway shows the code 'MM_TEARDWON_IN_PROGRESS'!

By removing the line 'proto_notify_error "${interface}" MM_TEARDOWN_IN_PROGRESS'
in teardown, the last error is show in the proto stack from setup.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-07-24 09:41:51 +02:00
Mladen Milinkovic f3943dbb2a modemmanager: support setting plmn
Signed-off-by: Mladen Milinkovic <maxrd2@smoothware.net>
2023-07-21 16:39:01 +02:00
Florian Eckert fd63e400ba modemmanager: if an alias name is used do not check sysfs path
If an alias name is used for the modem, then a check if the device exists
in sysfs does not work. To fix this remove the check if the sysfs device
exists. The protocoll handler already checks if the modem is responsible
for this device on the next line.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-06-15 15:45:16 +02:00
Florian Eckert e66fead6d4 modemmanager: do not cache virtual device events
On small systems with many virtual devices, the modem manager sometimes
could not start because it took too long until all devices for the modem
were recognised. This is because all system events that are stored in
the file events.cache have to be processed. To speed up the processing,
all devices under /sys/devices/virtual are now filtered out so that they
do not have to be processed.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-06-15 15:09:55 +02:00
Andre Heider 35f4ef76e0 treewide: refactor to use PKG_BUILD_FLAGS:=gc-sections
See commit da370098 "treewide: add support for "gc-sections" in
PKG_BUILD_FLAGS" on the main repository.

Note: This only touches packages which use all three parts
(-ffunction-sections, -fdata-sections and -Wl,--gc-sections) enabled by
this build flag. Some packages only use a subset, and these are left
unchanged for now.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2023-04-08 08:38:54 +02:00
Kuan-Yi Li 0c526d09a8 modemmanager: bump to 1.20.6
Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
2023-03-09 14:13:13 +08:00
Kuan-Yi Li cec29e9105 modemmanager: bump to 1.20.2
Drop deprecated AUTORELEASE.

Disable unused tests as its compilation is optional in 1.20.

Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
2022-12-09 06:32:32 +08:00
Aleksander Morgado eb283ea8a3 modemmanager: fix unquoted strings when launching pppd
Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2022-11-11 15:16:03 -08:00
Maxim Anisimov c588b92d51 modemmanager: bump to 1.18.12
Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
2022-09-14 22:12:01 +03:00
Arkadiusz Drabczyk cdbc7a67fc modemmanager: fix mm_log() invocations in 25-modemmanager* files
Definition of mm_log() was changed in
45a56a8899 but 25-modemmanager* weren't
changed.

Signed-off-by: Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
2022-07-24 10:35:43 -07:00
Aleksander Morgado c15e94f6c5 modemmanager: explicitly disconnect even if no bearers found
A network restart where netifd is cleanly restarted involves bringing
the network interfaces down. The 'modemmanager' protocol handler will
run a mmcli --simple-disconnect in this case, but only if there are
bearer objects found.

If the network restart happened *during* the connection attempt
procedure, while the modem is e.g. being registered in the network, no
bearer objects exist yet, and so, we would skip doing anything during
the interface teardown operation. This would lead to the original
connection attempt succeeding, so leaving the modem in ModemManager
in connected state, while the associated interface in netifd is
reported down.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2022-07-05 21:59:51 -07:00
Rosen Penev df5d7245b9 treewide: remove PKG_INSTALL for meson projects
It doesn't seem to be used by meson.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-06-15 18:07:46 -07:00
Aleksander Morgado bc754f31cf modemmanager: report network initiated disconnections to netifd
The new connection dispatcher scripts support integrated in
ModemManager 1.18.8 allows us to provide a openwrt-specific dispatcher
script used to report netifd that the underlying network connection is
down.

See also https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/775

Fixes https://github.com/openwrt/openwrt/issues/8368
Fixes https://github.com/openwrt/packages/issues/14096

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2022-05-14 21:39:50 -07:00
Aleksander Morgado e430420aa1 modemmanager: install available FCC unlock scripts
The FCC unlock scripts are installed but not enabled by default.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2022-05-14 21:39:50 -07:00
Aleksander Morgado 43d4e8fff8 modemmanager: bump to 1.18.8
Also removed two patches that are already included in the upstream
release.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2022-05-14 21:39:50 -07:00