mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add force connection setting to ModemManager
This commit is contained in:
parent
da1accdb06
commit
380117a155
1 changed files with 17 additions and 6 deletions
|
@ -276,6 +276,7 @@ proto_modemmanager_init_config() {
|
||||||
proto_config_add_int signalrate
|
proto_config_add_int signalrate
|
||||||
proto_config_add_boolean lowpower
|
proto_config_add_boolean lowpower
|
||||||
proto_config_add_boolean allow_roaming
|
proto_config_add_boolean allow_roaming
|
||||||
|
proto_config_add_boolean force_connection
|
||||||
proto_config_add_string init_epsbearer
|
proto_config_add_string init_epsbearer
|
||||||
proto_config_add_string init_iptype
|
proto_config_add_string init_iptype
|
||||||
proto_config_add_string 'init_allowedauth:list(string)'
|
proto_config_add_string 'init_allowedauth:list(string)'
|
||||||
|
@ -423,6 +424,7 @@ proto_modemmanager_setup() {
|
||||||
|
|
||||||
local device apn allowedauth username password pincode
|
local device apn allowedauth username password pincode
|
||||||
local iptype plmn metric signalrate allow_roaming
|
local iptype plmn metric signalrate allow_roaming
|
||||||
|
local force_connection
|
||||||
|
|
||||||
local init_epsbearer
|
local init_epsbearer
|
||||||
local init_iptype init_allowedauth
|
local init_iptype init_allowedauth
|
||||||
|
@ -432,7 +434,7 @@ proto_modemmanager_setup() {
|
||||||
|
|
||||||
json_get_vars device apn allowedauth username password
|
json_get_vars device apn allowedauth username password
|
||||||
json_get_vars pincode iptype sourcefilter plmn metric signalrate allow_roaming
|
json_get_vars pincode iptype sourcefilter plmn metric signalrate allow_roaming
|
||||||
json_get_vars allowedmode preferredmode
|
json_get_vars allowedmode preferredmode force_connection
|
||||||
|
|
||||||
json_get_vars init_epsbearer
|
json_get_vars init_epsbearer
|
||||||
json_get_vars init_iptype init_allowedauth
|
json_get_vars init_iptype init_allowedauth
|
||||||
|
@ -473,8 +475,13 @@ proto_modemmanager_setup() {
|
||||||
mmcli --modem="${device}" \
|
mmcli --modem="${device}" \
|
||||||
--timeout 120 \
|
--timeout 120 \
|
||||||
--3gpp-register-in-operator="${plmn}" || {
|
--3gpp-register-in-operator="${plmn}" || {
|
||||||
proto_notify_error "${interface}" MM_3GPP_OPERATOR_REGISTRATION_FAILED
|
if [ -n "${force_connection}" ] && [ "${force_connection}" -eq 1 ]; then
|
||||||
proto_block_restart "${interface}"
|
echo "3GPP operator registration failed -> attempting restart"
|
||||||
|
proto_notify_error "${interface}" MM_INTERFACE_RESTART
|
||||||
|
else
|
||||||
|
proto_notify_error "${interface}" MM_3GPP_OPERATOR_REGISTRATION_FAILED
|
||||||
|
proto_block_restart "${interface}"
|
||||||
|
fi
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -551,7 +558,6 @@ proto_modemmanager_setup() {
|
||||||
|
|
||||||
# setup connect args; APN mandatory (even if it may be empty)
|
# setup connect args; APN mandatory (even if it may be empty)
|
||||||
echo "starting connection with apn '${apn}'..."
|
echo "starting connection with apn '${apn}'..."
|
||||||
proto_notify_error "${interface}" MM_CONNECT_IN_PROGRESS
|
|
||||||
|
|
||||||
# setup allow-roaming parameter
|
# setup allow-roaming parameter
|
||||||
if [ -n "${allow_roaming}" ] && [ "${allow_roaming}" -eq 0 ];then
|
if [ -n "${allow_roaming}" ] && [ "${allow_roaming}" -eq 0 ];then
|
||||||
|
@ -576,8 +582,13 @@ proto_modemmanager_setup() {
|
||||||
append_param "${password:+password=${password}}"
|
append_param "${password:+password=${password}}"
|
||||||
|
|
||||||
mmcli --modem="${device}" --timeout 120 --simple-connect="${connectargs}" || {
|
mmcli --modem="${device}" --timeout 120 --simple-connect="${connectargs}" || {
|
||||||
proto_notify_error "${interface}" MM_CONNECT_FAILED
|
if [ -n "${force_connection}" ] && [ "${force_connection}" -eq 1 ]; then
|
||||||
proto_block_restart "${interface}"
|
echo "Connection failed -> attempting restart"
|
||||||
|
proto_notify_error "${interface}" MM_INTERFACE_RESTART
|
||||||
|
else
|
||||||
|
proto_notify_error "${interface}" MM_CONNECT_FAILED
|
||||||
|
proto_block_restart "${interface}"
|
||||||
|
fi
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue