diff --git a/src/network/wlanconfig.lua b/src/network/wlanconfig.lua index b7bff30..151f221 100644 --- a/src/network/wlanconfig.lua +++ b/src/network/wlanconfig.lua @@ -177,11 +177,13 @@ end function M.removeConfig(ssid) local rv = false uci:foreach('wireless', 'wifi-iface', function(s) + log:verbose(MOD_ABBR, utils.dump(s.ssid).."\n "..utils.dump(s)) if s.ssid == ssid then - uci:delete('wireless', s['.name']) - rv = true + log:verbose(MOD_ABBR, "deleting faulty ssid: "..utils.dump(s['.name'])) + rv = uci:delete('wireless', s['.name']) end end) + uci:save('wireless') uci:commit('wireless') return rv end diff --git a/src/rest/api/api_network.lua b/src/rest/api/api_network.lua index 4deec6c..28a5fab 100644 --- a/src/rest/api/api_network.lua +++ b/src/rest/api/api_network.lua @@ -154,6 +154,11 @@ 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)..")") + wifi.removeConfig(argSsid) + local backupssid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid')) + netconf.setupAccessPoint(backupssid) + netconf.enableAccessPoint(backupssid) + wifi.removeConfig(argSsid) end end