diff --git a/src/network/netconfig.lua b/src/network/netconfig.lua index 170aa05..60bb5fb 100644 --- a/src/network/netconfig.lua +++ b/src/network/netconfig.lua @@ -386,11 +386,7 @@ function M.associateSsid(ssid, passphrase, recreate) if attempt >= maxAttempts then -- still no correct ssid; fail local msg = "Could not associate with network (incorrect password?)" - wifi.removeConfig(ssid) M.setStatus(M.CONNECTING_FAILED,msg); - local backupssid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid')) - M.setupAccessPoint(backupssid) - M.enableAccessPoint(backupssid) return false, msg else nextAttemptTime = os.time() + attemptInterval diff --git a/src/network/wlanconfig.lua b/src/network/wlanconfig.lua index 77ee5fe..4731aab 100644 --- a/src/network/wlanconfig.lua +++ b/src/network/wlanconfig.lua @@ -182,9 +182,6 @@ function M.removeConfig(ssid) log:info(MOD_ABBR, "deleting faulty ssid: "..utils.dump(s['.name'])) rv = uci:delete('wireless', s['.name']) end - if s.disabled == 1 then - M.activateConfig(s.ssid) - end end) uci:save('wireless') uci:commit('wireless') diff --git a/src/rest/api/api_network.lua b/src/rest/api/api_network.lua index 2c4992a..2570b49 100644 --- a/src/rest/api/api_network.lua +++ b/src/rest/api/api_network.lua @@ -154,6 +154,10 @@ function M.associate_POST(request, response) log:info(MOD_ABBR, "associated to wifi: "..utils.dump(argSsid)) else log:info(MOD_ABBR, "failed to associate to wifi: "..utils.dump(argSsid).." ("..utils.dump(msg)..")") + local backupssid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid')) + netconf.setupAccessPoint(backupssid) + netconf.enableAccessPoint(backupssid) + wifi.removeConfig(argSsid) end end