Commit graph

17 commits

Author SHA1 Message Date
Aleksander Morgado
a7108c9e12 modemmanager: include all init commands in the procd instance
If procd relaunches the ModemManager daemon after e.g. a crash, we
also want it to notify all cached hotplug events, or otherwise we
would end up leaving the daemon running without the full initial
processing done.

This change modifies the init script to include all the required init
commands as part of the procd instance command, so that procd launches
all of them on every respawn.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-11-02 10:55:17 +01:00
Aleksander Morgado
9a16087fd6 modemmanager: increase initial timeout for event reporting
When the ModemManager daemon is started by the init script, we're
explicitly calling mm_report_events_from_cache() so that all the
hotplug events that happened before that moment are properly notified
to the newly launched daemon.

This initial reporting of events does a wait for the ModemManager
process to be available in DBus, and if the daemon isn't registered in
the bus in a given time, the process is considered failed:

  Sun Sep  6 16:20:02 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:02 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:03 2020 [2180]: <info>  ModemManager (version 1.14.6) starting in system bus...
  Sun Sep  6 16:20:03 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:04 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:05 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:05 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:06 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:06 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:07 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:07 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:08 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:08 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:09 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:09 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:10 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:10 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:11 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:11 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:12 2020 ModemManager: hotplug: checking if ModemManager is available...
  Sun Sep  6 16:20:12 2020 ModemManager: hotplug: ModemManager not yet available
  Sun Sep  6 16:20:12 2020 ModemManager: hotplug: error: couldn't report initial kernel events: ModemManager not running

Update the default wait time for this initial event notification from
10s to 60s, because there are cases where the daemon is slower to
boot, e.g. during the first boot after a sysupgrade.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-10-30 23:29:55 +01:00
Nicholas Smith
377a33730d modemmanager: add error message notifications to proto handler
Signed-off-by: Nicholas Smith <nicholas.smith@telcoantennas.com.au>
2020-07-10 20:28:31 +10:00
Rosen Penev
8a965ca029
Merge pull request #12086 from aleksander0m/aleksander/mm-auth
Authentication protocol setup in ModemManager
2020-06-28 20:01:26 -07:00
Aleksander Morgado
41552c1cc2 modemmanager: set interface MTU based on bearer settings
Using the same method used by other protocol handlers like uqmi.

Fixes https://github.com/openwrt/packages/issues/11383

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-05-25 15:35:50 +02:00
Aleksander Morgado
c5c5620f20 modemmanager: allow specifying list of authentication protocols
ModemManager allows specifying which are the authentication protocols
to be used during the user/password context authentication with the
peer.

This protocol update allows users to provide a new 'allowedauth'
option in the interface configuration, which is then used in two
different places:
 * It is sent to ModemManager in the --simple-connect call so that
   modems with a network interface can perform the authentication
   using their own vendor-specific protocol.
 * If the connection is done using PPP, this list of protocols is used
   to configure the pppd call.

If the new 'allowedauth' option is not given, all auth protocols are
implicitly allowed.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2020-05-14 09:19:54 +02:00
Aleksander Morgado
5f11888b12 modemmanager: install common utils in /usr/share/ModemManager
The modemmanager.common file includes several utility functions that
are used in several places like the protocol handler and in hotplug
scripts. These utilities should not be installed in /etc as they're
not configuration.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-11-27 09:28:10 +01:00
Aleksander Morgado
ecad39fd60 modemmanager: don't flag the 'device' option as 'device' type
Unlike other modem protocol handlers like the ones implemented by uqmi
or umbim, in the modemmanager protocol handler the 'device' option
does not specify a device node in /dev. Therefore, we shouldn't flag
the option as 'device' type (dt_type_device).

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-11-27 09:28:10 +01:00
Aleksander Morgado
a684cdbab0 modemmanager: fix device unplug handling
When a USB modem device is unplugged, we had to do two different
things: first, cleanup the sysfs cache; and second, set interface as
unavailable.

Those two things were never being done properly due to several
different issues:

 * The parent sysfs path retrieval logic relies on checking for which
 sysfs path has the vid/pid files. This logic obviously only works
 when the device is available, and cannot be used on e.g. removal
 events.

 * The command to cleanup the modem wait status from the sysfs cache
 was not removing the previous state properly, because the sysfs path
 variable wasn't escaped properly for the sed command.

This patch handles those issues in order to have a proper device
removal handling, by making sure the sysfs path is properly escaped in
the sed command, and by introducing a new hotplug script that runs
when the full USB device is removed.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-11-27 09:28:10 +01:00
Aleksander Morgado
cc4ee2fd3c modemmanager: flag as available and no_device when initializing
Otherwise, if the modem is reseted, netifd will think that the device
is gone forever.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-11-27 09:28:10 +01:00
Aleksander Morgado
92781ecc7f modemmanager: add default proto configs
Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-11-27 09:28:10 +01:00
Aleksander Morgado
470fcc221b modemmanager: fix 'any' iptype setting
When the user requests 'any' as 'iptype', we may get either IPv4 or
IPv6 settings.

Simplify the logic by not requiring any explicit iptype before loading
the method reported by the bearer object for IPv4 and IPv6; just load
the methods right away and setup settings based on those.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-11-15 15:41:25 +01:00
Aleksander Morgado
859becef19 modemmanager: add IPv6/IPv4v6 support
Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-11-08 11:27:13 +01:00
Aleksander Morgado
fc47c47b39 modemmanager: add proto dynamic defaults on dhcp setup
Also, explicitly close the JSON object.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-11-07 10:01:39 +01:00
Aleksander Morgado
fa3f9542de modemmanager: add missing path for PID file
The procd based init setup uses a custom `pidfile` parameter, but the
used MODEMMANAGER_PID_FILE was not being defined anywhere.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-11-07 10:01:39 +01:00
Aleksander Morgado
35b93c81ff modemmanager: fix bearer disconnection logic
The bearer status wasn't being loaded in key/value mode, and therefore
would always fail to load the IPv4 config method.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
2019-11-07 10:01:39 +01:00
Nicholas Smith
180fb0d622 modemmanager: add ModemManager to packages
Signed-off-by: Nicholas Smith <nicholas.smith@telcoantennas.com.au>
2019-09-27 11:26:51 +10:00