modules/admin-full: redirect back to overview page if trying to configure not existin...
[project/luci.git] / modules / admin-full / luasrc / model / cbi / admin_network / wifi.lua
index 00bd560..d6abfd6 100644 (file)
@@ -45,10 +45,14 @@ ww.init(m.uci)
 
 local wnet = ww:get_network(arg[2])
 
-if wnet then
-       m.title = wnet and ww:get_i18n(wnet)
+-- redirect to overview page if network does not exist anymore (e.g. after a revert)
+if not wnet then
+       luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless"))
+       return
 end
 
+m.title = ww:get_i18n(wnet)
+
 
 local iw = nil
 local tx_powers = nil
@@ -92,7 +96,7 @@ local nsantenna = m:get(arg[1], "antenna")
 ch = s:taboption("general", Value, "channel", translate("Channel"))
 ch:value("auto", translate("auto"))
 for _, f in ipairs(luci.sys.wifi.channels()) do
-       ch:value(f.channel, "%i (%.3f GHz)" %{ f.channel, f.mhz })
+       ch:value(f.channel, "%i (%.3f GHz)" %{ f.channel, f.mhz / 1000 })
 end
 
 
@@ -507,11 +511,15 @@ if wnet then
        server = s:taboption("encryption", Value, "server", translate("Radius-Server"))
        server:depends({mode="ap", encryption="wpa"})
        server:depends({mode="ap", encryption="wpa2"})
+       server:depends({mode="ap-wds", encryption="wpa"})
+       server:depends({mode="ap-wds", encryption="wpa2"})
        server.rmempty = true
 
        port = s:taboption("encryption", Value, "port", translate("Radius-Port"))
        port:depends({mode="ap", encryption="wpa"})
        port:depends({mode="ap", encryption="wpa2"})
+       port:depends({mode="ap-wds", encryption="wpa"})
+       port:depends({mode="ap-wds", encryption="wpa2"})
        port.rmempty = true
 
        key = s:taboption("encryption", Value, "key", translate("Key"))
@@ -522,6 +530,8 @@ if wnet then
        key:depends("encryption", "psk-mixed")
        key:depends({mode="ap", encryption="wpa"})
        key:depends({mode="ap", encryption="wpa2"})
+       key:depends({mode="ap-wds", encryption="wpa"})
+       key:depends({mode="ap-wds", encryption="wpa2"})
        key.rmempty = true
        key.password = true
 
@@ -529,6 +539,8 @@ if wnet then
                nasid = s:taboption("encryption", Value, "nasid", translate("NAS ID"))
                nasid:depends({mode="ap", encryption="wpa"})
                nasid:depends({mode="ap", encryption="wpa2"})
+               nasid:depends({mode="ap-wds", encryption="wpa"})
+               nasid:depends({mode="ap-wds", encryption="wpa2"})
                nasid.rmempty = true
 
                eaptype = s:taboption("encryption", ListValue, "eap_type", translate("EAP-Method"))