modules/admin-full: fix wifi join when "wwan" (or other iface) already exists but only contains the network we intend to replace anyway, also save firewall settings after wifi join

This commit is contained in:
Jo-Philipp Wich 2011-10-26 21:54:51 +00:00
parent d60d892385
commit 017d24c724
2 changed files with 38 additions and 36 deletions

View file

@ -25,6 +25,7 @@ m = Map("wireless", "",
"like encryption or operation mode are grouped in the <em>Interface Configuration</em>."))
m:chain("network")
m:chain("firewall")
local ifsection

View file

@ -104,9 +104,6 @@ end
function newnet.parse(self, section)
local net, zone
local value = self:formvalue(section)
net = nw:add_network(value, { proto = "dhcp" })
if has_firewall then
local zval = fwzone:formvalue(section)
zone = fw:get_zone(zval)
@ -119,9 +116,6 @@ function newnet.parse(self, section)
end
end
if not net then
self.error = { [section] = "missing" }
else
local wdev = nw:get_wifidev(m.hidden.device)
wdev:set("disabled", false)
@ -137,8 +131,7 @@ function newnet.parse(self, section)
local wconf = {
device = m.hidden.device,
ssid = m.hidden.join,
mode = (m.hidden.mode == "Ad-Hoc" and "adhoc" or "sta"),
network = net:name()
mode = (m.hidden.mode == "Ad-Hoc" and "adhoc" or "sta")
}
if m.hidden.wep == "1" then
@ -156,6 +149,14 @@ function newnet.parse(self, section)
wconf.bssid = m.hidden.bssid
end
local value = self:formvalue(section)
net = nw:add_network(value, { proto = "dhcp" })
if not net then
self.error = { [section] = "missing" }
else
wconf.network = net:name()
local wnet = wdev:add_wifinet(wconf)
if wnet then
if zone then