2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
14 require("luci.tools.webadmin")
17 m = Map("wireless", translate("networks"), translate("a_w_networks1"))
19 s = m:section(NamedSection, arg[1], "wifi-device", translate("device") .. " " .. arg[1])
22 en = s:option(Flag, "disabled", translate("enable"))
26 function en.cfgvalue(self, section)
27 return Flag.cfgvalue(self, section) or "0"
30 t = s:option(DummyValue, "type", translate("type"))
32 mode = s:option(ListValue, "mode", translate("mode"))
33 mode:value("", "standard")
34 mode:value("11b", "802.11b")
35 mode:value("11g", "802.11g")
36 mode:value("11a", "802.11a")
37 mode:value("11bg", "802.11b+g")
40 ch = s:option(Value, "channel", translate("a_w_channel"))
42 ch:value(i, i .. " (2.4 GHz)")
45 ch:value(i, i .. " (5 GHz)")
48 ch:value(i, i .. " (5 GHz)")
50 ch:value(147, 147 .. " (5 GHz)")
51 ch:value(151, 151 .. " (5 GHz)")
52 ch:value(155, 155 .. " (5 GHz)")
53 ch:value(167, 167 .. " (5 GHz)")
55 s:option(Value, "txantenna", translate("a_w_txantenna")).optional = true
57 s:option(Value, "rxantenna", translate("a_w_rxantenna")).optional = true
59 s:option(Value, "distance", translate("distance"),
60 translate("a_w_distance1")).optional = true
62 s:option(Value, "diversity", translate("a_w_diversity")):depends("type", "atheros")
64 country = s:option(Value, "country", translate("a_w_countrycode"))
65 country.optional = true
66 country:depends("type", "broadcom")
68 maxassoc = s:option(Value, "maxassoc", translate("a_w_connlimit"))
69 maxassoc:depends("type", "broadcom")
70 maxassoc.optional = true
74 s = m:section(TypedSection, "wifi-iface", translate("interfaces"))
77 s:depends("device", arg[1])
78 s.defaults.device = arg[1]
80 s:option(Value, "ssid", translate("a_w_netid")).maxlength = 32
82 network = s:option(Value, "network", translate("network"), translate("a_w_network1"))
83 network.rmempty = true
85 network.combobox_manual = translate("a_w_netmanual")
86 luci.tools.webadmin.cbi_add_networks(network)
88 function network.write(self, section, value)
89 if not luci.model.uci.get("network", value) then
91 luci.model.uci.set("network", value, "interface")
92 Value.write(self, section, value)
94 if luci.model.uci.get("network", value) == "interface" then
95 Value.write(self, section, value)
100 mode = s:option(ListValue, "mode", translate("mode"))
101 mode:value("ap", translate("a_w_ap"))
102 mode:value("adhoc", translate("a_w_adhoc"))
103 mode:value("ahdemo", translate("a_w_ahdemo"))
104 mode:value("sta", translate("a_w_client"))
105 mode:value("wds", translate("a_w_wds"))
106 mode:value("monitor", translate("a_w_monitor"))
108 s:option(Value, "bssid", "BSSID").optional = true
110 s:option(Value, "txpower", translate("a_w_txpwr"), "dbm").rmempty = true
112 s:option(Flag, "frameburst", translate("a_w_brcmburst")).optional = true
113 s:option(Flag, "bursting", translate("a_w_athburst")).optional = true
116 encr = s:option(ListValue, "encryption", translate("encryption"))
117 encr:value("none", "keine")
118 encr:value("wep", "WEP")
119 encr:value("PSK", "WPA-PSK")
120 encr:value("WPA", "WPA-EAP", {mode="ap"}, {mode="sta"})
121 encr:value("PSK2", "WPA2-PSK")
122 encr:value("WPA2", "WPA2-EAP", {mode="ap"}, {mode="sta"})
123 encr:depends("mode", "ap")
124 encr:depends("mode", "sta")
125 encr:depends("mode", "wds")
127 server = s:option(Value, "server", translate("a_w_radiussrv"))
128 server:depends({mode="ap", encryption="WPA"})
129 server:depends({mode="ap", encryption="WPA2"})
130 server.rmempty = true
132 port = s:option(Value, "port", translate("a_w_radiusport"))
133 port:depends({mode="ap", encryption="WPA"})
134 port:depends({mode="ap", encryption="WPA2"})
137 key = s:option(Value, "key", translate("key"))
138 key:depends("encryption", "wep")
139 key:depends("encryption", "PSK")
140 key:depends({mode="ap", encryption="WPA"})
141 key:depends("encryption", "PSK2")
142 key:depends({mode="ap", encryption="WPA2"})
145 nasid = s:option(Value, "nasid", translate("a_w_nasid"))
146 nasid:depends({mode="ap", encryption="WPA"})
147 nasid:depends({mode="ap", encryption="WPA2"})
150 eaptype = s:option(ListValue, "eap_type", translate("a_w_eaptype"))
152 eaptype:value("PEAP")
153 eaptype:depends({mode="sta", encryption="WPA"})
154 eaptype:depends({mode="sta", encryption="WPA2"})
156 cacert = s:option(Value, "ca_cert", translate("a_w_cacert"))
157 cacert:depends({mode="sta", encryption="WPA"})
158 cacert:depends({mode="sta", encryption="WPA2"})
160 privkey = s:option(Value, "priv_key", translate("a_w_tlsprivkey"))
161 privkey:depends({mode="sta", eap_type="TLS", encryption="WPA2"})
162 privkey:depends({mode="sta", eap_type="TLS", encryption="WPA"})
164 privkeypwd = s:option(Value, "priv_key_pwd", translate("a_w_tlsprivkeypwd"))
165 privkeypwd:depends({mode="sta", eap_type="TLS", encryption="WPA2"})
166 privkeypwd:depends({mode="sta", eap_type="TLS", encryption="WPA"})
169 auth = s:option(Value, "auth", translate("a_w_peapauth"))
170 auth:depends({mode="sta", eap_type="PEAP", encryption="WPA2"})
171 auth:depends({mode="sta", eap_type="PEAP", encryption="WPA"})
173 identity = s:option(Value, "identity", translate("a_w_peapidentity"))
174 identity:depends({mode="sta", eap_type="PEAP", encryption="WPA2"})
175 identity:depends({mode="sta", eap_type="PEAP", encryption="WPA"})
177 password = s:option(Value, "password", translate("a_w_peappassword"))
178 password:depends({mode="sta", eap_type="PEAP", encryption="WPA2"})
179 password:depends({mode="sta", eap_type="PEAP", encryption="WPA"})
184 s:option(Flag, "isolate", translate("a_w_apisolation"), translate("a_w_apisolation1")).optional = true
186 s:option(Flag, "hidden", translate("a_w_hideessid")).optional = true