modemmanager: Adding support for 'allow_roaming' option
authorFrancisco Jose Alvarez <francisco.alvarez@galgus.net>
Fri, 7 Oct 2022 06:44:00 +0000 (08:44 +0200)
committerFlorian Eckert <fe@dev.tdt.de>
Mon, 24 Jul 2023 11:21:45 +0000 (13:21 +0200)
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>
(cherry picked from commit 7ba2c969b2708573513db5b180ca14313478de4d)

net/modemmanager/Makefile
net/modemmanager/README.md
net/modemmanager/files/modemmanager.proto

index 0e69b1ccdfdb5dbff48e794d05caa7f1bc90807b..996f1885d50ffed7a5f457e5346e8202134f1fb6 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=modemmanager
 PKG_SOURCE_VERSION:=1.20.6
-PKG_RELEASE:=6
+PKG_RELEASE:=7
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git
index e79b100c92e24be1d65ceed3989ec2ac61c75c0d..93a7f9b09165618b830afe1000be0dbee3db2147 100644 (file)
@@ -25,6 +25,7 @@ Once installed, you can configure the 2G/3G/4G modem connections directly in
         option plmn        '214001'
         option lowpower    '1'
         option signalrate  '30'
+        option allow_roaming '1'
 
 Only 'device' and 'proto' are mandatory options, the remaining ones are all
 optional.
index a3b7785de5932b6e91d8628302029b8275533669..a0f6c357e3ac186a90c5f0bbb59e75161b854c94 100755 (executable)
@@ -346,6 +346,7 @@ proto_modemmanager_init_config() {
        proto_config_add_string  plmn
        proto_config_add_int     signalrate
        proto_config_add_boolean lowpower
+       proto_config_add_boolean allow_roaming
        proto_config_add_defaults
 }
 
@@ -356,11 +357,11 @@ proto_modemmanager_setup() {
        local bearermethod_ipv4 bearermethod_ipv6 auth cliauth
        local operatorname operatorid registration accesstech signalquality
 
-       local device apn allowedauth username password pincode iptype plmn metric signalrate
+       local device apn allowedauth username password pincode iptype plmn metric signalrate allow_roaming
 
        local address prefix gateway mtu dns1 dns2
 
-       json_get_vars device apn allowedauth username password pincode iptype plmn metric signalrate
+       json_get_vars device apn allowedauth username password pincode iptype plmn metric signalrate allow_roaming
 
        # validate sysfs path given in config
        [ -n "${device}" ] || {
@@ -393,7 +394,15 @@ proto_modemmanager_setup() {
        echo "starting connection with apn '${apn}'..."
        proto_notify_error "${interface}" MM_CONNECT_IN_PROGRESS
 
-       connectargs="apn=${apn}${iptype:+,ip-type=${iptype}}${plmn:+,operator-id=${plmn}}${cliauth:+,allowed-auth=${cliauth}}${username:+,user=${username}}${password:+,password=${password}}${pincode:+,pin=${pincode}}"
+       # setup allow-roaming parameter
+       if [ -n "${allow_roaming}" ] && [ "${allow_roaming}" -eq 0 ];then
+               allow_roaming="no"
+       else
+               # allowed unless a user set the opposite
+               allow_roaming="yes"
+       fi
+       connectargs="apn=${apn},allow-roaming=${allow_roaming}${iptype:+,ip-type=${iptype}}${plmn:+,operator-id=${plmn}}${cliauth:+,allowed-auth=${cliauth}}${username:+,user=${username}}${password:+,password=${password}}${pincode:+,pin=${pincode}}"
+
        mmcli --modem="${device}" --timeout 120 --simple-connect="${connectargs}" || {
                proto_notify_error "${interface}" MM_CONNECT_FAILED
                proto_block_restart "${interface}"