From c45f6b670d4fba689a4fe0e2c9849840f2d13b14 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 2 Oct 2011 10:25:32 +0000 Subject: [PATCH] modules/admin-full: align wifi settings with recent hostapd.sh in OpenWrt (#261) --- .../luasrc/model/cbi/admin_network/wifi.lua | 78 +++++++++++++------ 1 file changed, 55 insertions(+), 23 deletions(-) diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua index b18d142511..51b84df22e 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua @@ -558,6 +558,14 @@ encr:depends({mode="ap-wds"}) encr:depends({mode="sta-wds"}) encr:depends({mode="mesh"}) +function encr.write(self, section, value) + if value == "wpa" or value == "wpa2" then + self.map.uci:delete("wireless", section, "key") + end + self.map.uci:set("wireless", section, "encryption", value) +end + + encr:value("none", "No Encryption") encr:value("wep-open", translate("WEP Open System"), {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}) encr:value("wep-shared", translate("WEP Shared Key"), {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}) @@ -604,35 +612,59 @@ elseif hwtype == "broadcom" then encr:value("psk+psk2", "WPA-PSK/WPA2-PSK Mixed Mode") end -encr:depends("mode", "ap") -encr:depends("mode", "sta") -encr:depends("mode", "ap-wds") -encr:depends("mode", "sta-wds") -encr:depends("mode", "wds") - -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 +auth_server = s:taboption("encryption", Value, "auth_server", translate("Radius-Authentication-Server")) +auth_server:depends({mode="ap", encryption="wpa"}) +auth_server:depends({mode="ap", encryption="wpa2"}) +auth_server:depends({mode="ap-wds", encryption="wpa"}) +auth_server:depends({mode="ap-wds", encryption="wpa2"}) +auth_server.rmempty = true +auth_server.datatype = "host" + +auth_port = s:taboption("encryption", Value, "auth_port", translate("Radius-Authentication-Port"), translatef("Default %d", 1812)) +auth_port:depends({mode="ap", encryption="wpa"}) +auth_port:depends({mode="ap", encryption="wpa2"}) +auth_port:depends({mode="ap-wds", encryption="wpa"}) +auth_port:depends({mode="ap-wds", encryption="wpa2"}) +auth_port.rmempty = true +auth_port.datatype = "port" + +auth_secret = s:taboption("encryption", Value, "auth_secret", translate("Radius-Authentication-Secret")) +auth_secret:depends({mode="ap", encryption="wpa"}) +auth_secret:depends({mode="ap", encryption="wpa2"}) +auth_secret:depends({mode="ap-wds", encryption="wpa"}) +auth_secret:depends({mode="ap-wds", encryption="wpa2"}) +auth_secret.rmempty = true +auth_secret.password = true + +acct_server = s:taboption("encryption", Value, "acct_server", translate("Radius-Accounting-Server")) +acct_server:depends({mode="ap", encryption="wpa"}) +acct_server:depends({mode="ap", encryption="wpa2"}) +acct_server:depends({mode="ap-wds", encryption="wpa"}) +acct_server:depends({mode="ap-wds", encryption="wpa2"}) +acct_server.rmempty = true +acct_server.datatype = "host" + +acct_port = s:taboption("encryption", Value, "acct_port", translate("Radius-Accounting-Port"), translatef("Default %d", 1813)) +acct_port:depends({mode="ap", encryption="wpa"}) +acct_port:depends({mode="ap", encryption="wpa2"}) +acct_port:depends({mode="ap-wds", encryption="wpa"}) +acct_port:depends({mode="ap-wds", encryption="wpa2"}) +acct_port.rmempty = true +acct_port.datatype = "port" + +acct_secret = s:taboption("encryption", Value, "acct_secret", translate("Radius-Accounting-Secret")) +acct_secret:depends({mode="ap", encryption="wpa"}) +acct_secret:depends({mode="ap", encryption="wpa2"}) +acct_secret:depends({mode="ap-wds", encryption="wpa"}) +acct_secret:depends({mode="ap-wds", encryption="wpa2"}) +acct_secret.rmempty = true +acct_secret.password = true wpakey = s:taboption("encryption", Value, "_wpa_key", translate("Key")) wpakey:depends("encryption", "psk") wpakey:depends("encryption", "psk2") wpakey:depends("encryption", "psk+psk2") wpakey:depends("encryption", "psk-mixed") -wpakey:depends({mode="ap", encryption="wpa"}) -wpakey:depends({mode="ap", encryption="wpa2"}) -wpakey:depends({mode="ap-wds", encryption="wpa"}) -wpakey:depends({mode="ap-wds", encryption="wpa2"}) wpakey.datatype = "wpakey" wpakey.rmempty = true wpakey.password = true -- 2.30.2