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
}
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}" ] || {
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}"