From: Florian Eckert Date: Wed, 21 Feb 2024 15:03:07 +0000 (+0100) Subject: modemmanager: move cleanup and enable to the top X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=d839e194c50267f3b1fcae51d76ac96b4c36bd76;p=feed%2Fpackages.git 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 --- diff --git a/net/modemmanager/files/lib/netifd/proto/modemmanager.sh b/net/modemmanager/files/lib/netifd/proto/modemmanager.sh index b059b4c59c..9659726837 100644 --- a/net/modemmanager/files/lib/netifd/proto/modemmanager.sh +++ b/net/modemmanager/files/lib/netifd/proto/modemmanager.sh @@ -458,6 +458,14 @@ proto_modemmanager_setup() { modemmanager_check_state "$device" "${modemstatus}" "$pincode" [ "$?" -ne "0" ] && return 1 + # always cleanup before attempting a new connection, just in case + modemmanager_cleanup_connection "${modemstatus}" + + mmcli --modem="${device}" --timeout 120 --enable || { + proto_notify_error "${interface}" MM_MODEM_DISABLED + return 1 + } + if [ -z "${allowedmode}" ]; then modemmanager_set_allowed_mode "$device" "$interface" "any" else @@ -487,14 +495,6 @@ proto_modemmanager_setup() { [ "$?" -ne "0" ] && return 1 fi - # always cleanup before attempting a new connection, just in case - modemmanager_cleanup_connection "${modemstatus}" - - mmcli --modem="${device}" --timeout 120 --enable || { - proto_notify_error "${interface}" MM_MODEM_DISABLED - return 1 - } - # set initial eps bearer settings [ -z "${init_epsbearer}" ] || { case "$init_epsbearer" in