modemmanager: reset to 'no' plmn if nothing is configured
authorFlorian Eckert <fe@dev.tdt.de>
Tue, 5 Nov 2024 07:55:40 +0000 (08:55 +0100)
committerFlorian Eckert <Eckert.Florian@googlemail.com>
Fri, 15 Nov 2024 10:17:05 +0000 (11:17 +0100)
If a configured 'plmn' is deleted from the configuration between a connection
setup, it will continue to be used because the modem remembers it.

Therefore, the 'plmn' stored in the modem must be deleted when a new
connection is established if it is no longer in the configuration.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
net/modemmanager/files/lib/netifd/proto/modemmanager.sh

index f5f91c0eae16af1b2d6ec18f667379451179c484..0aacc9f907de5c602866cfbb4f785efae63a55db 100644 (file)
@@ -673,11 +673,14 @@ proto_modemmanager_setup() {
                [ "$?" -ne "0" ] && return 1
        fi
 
-       [ -z "${plmn}" ] || {
+       if [ -z "${plmn}" ]; then
+               modemmanager_set_plmn "$device" "$interface" "" "$force_connection"
+               [ "$?" -ne "0" ] && return 1
+       else
                echo "starting network registration with plmn '${plmn}'..."
                modemmanager_set_plmn "$device" "$interface" "$plmn" "$force_connection"
                [ "$?" -ne "0" ] && return 1
-       }
+       fi
 
        # setup connect args; APN mandatory (even if it may be empty)
        echo "starting connection with apn '${apn}'..."