arg[1] = arg[1] or ""
arg[2] = arg[2] or ""
-m = Map("wireless", translate("Networks"), translate("You can run several wifi networks with one device. Be aware that there are certain hardware and driverspecific restrictions. Normally you can operate 1 Ad-Hoc or up to 3 Master-Mode and 1 Client-Mode network simultaneously."))
+m = Map("wireless", "",
+ translate("The <em>Device Configuration</em> section covers physical settings of the radio " ..
+ "hardware such as channel, transmit power or antenna selection which is shared among all " ..
+ "defined wireless networks (if the radio hardware is multi-SSID capable). Per network settings " ..
+ "like encryption or operation mode are grouped in the <em>Interface Configuration</em>."))
+
m:chain("network")
+m.breadcrumb = {
+ { luci.dispatcher.build_url("admin/network/wireless"), translate("Wireless Networks") }
+}
+
local ifsection
function m.on_commit(map)
nw.init(m.uci)
ww.init(m.uci)
+local wnet = ww:get_network(arg[2])
+
+-- 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
end
end)
-s = m:section(NamedSection, arg[1], "wifi-device", translate("Device") .. " " .. arg[1])
+s = m:section(NamedSection, arg[1], "wifi-device", translate("Device Configuration"))
s.addremove = false
s:tab("general", translate("General Setup"))
ch = s:taboption("general", Value, "channel", translate("Channel"))
ch:value("auto", translate("auto"))
-for c, f in luci.util.kspairs(luci.sys.wifi.channels()) do
- ch:value(c, "%i (%.3f GHz)" %{ c, f })
+for _, f in ipairs(luci.sys.wifi.channels()) do
+ ch:value(f.channel, "%i (%.3f GHz)" %{ f.channel, f.mhz / 1000 })
end
for _, p in ipairs(iw and iw.txpwrlist or {}) do
tp:value(p.dbm, "%i dBm (%i mW)" %{ p.dbm, p.mw })
end
+
+ mode = s:taboption("advanced", ListValue, "hwmode", translate("Mode"))
+ mode:value("", translate("auto"))
+ mode:value("11b", "802.11b")
+ mode:value("11g", "802.11g")
+ mode:value("11a", "802.11a")
+ mode:value("11ng", "802.11g+n")
+ mode:value("11na", "802.11a+n")
+
+ htmode = s:taboption("advanced", ListValue, "htmode", translate("HT mode"))
+ htmode:depends("hwmode", "11na")
+ htmode:depends("hwmode", "11ng")
+ htmode:value("HT20", "20MHz")
+ htmode:value("HT40-", translate("40MHz 2nd channel below"))
+ htmode:value("HT40+", translate("40MHz 2nd channel above"))
+
+ htcapab = s:taboption("advanced", DynamicList, "ht_capab", translate("HT capabilities"))
+ htcapab:depends("hwmode", "11na")
+ htcapab:depends("hwmode", "11ng")
+
+ s:taboption("advanced", Value, "country", translate("Country Code"), translate("Use ISO/IEC 3166 alpha2 country codes."))
+ s:taboption("advanced", Value, "distance", translate("Distance Optimization"),
+ translate("Distance to farthest network member in meters."))
end
s:taboption("advanced", Flag, "frameburst", translate("Frame Bursting"))
s:taboption("advanced", Value, "distance", translate("Distance Optimization"))
- --s:option(Value, "slottime", translate("wifi_slottime"))
+ --s:option(Value, "slottime", translate("Slot time"))
s:taboption("advanced", Value, "country", translate("Country Code"))
s:taboption("advanced", Value, "maxassoc", translate("Connection Limit"))
local wnet = ww:get_network(arg[2])
if wnet then
- s = m:section(NamedSection, wnet.sid, "wifi-iface", ww:get_i18n(wnet))
+ s = m:section(NamedSection, wnet.sid, "wifi-iface", translate("Interface Configuration"))
ifsection = s
s.addremove = false
s.anonymous = true
bssid = s:taboption("general", Value, "bssid", translate("<abbr title=\"Basic Service Set Identifier\">BSSID</abbr>"))
- network = s:taboption("general", Value, "network", translate("Network"), translate("Add the Wifi network to physical network"))
+ network = s:taboption("general", Value, "network", translate("Network"),
+ translate("Choose the network you want to attach to this wireless interface. " ..
+ "Select <em>unspecified</em> to not attach any network or fill out the " ..
+ "<em>create</em> field to define a new network."))
+
network.rmempty = true
network.template = "cbi/network_netlist"
network.widget = "radio"
s:taboption("advanced", Value, "frag", translate("Fragmentation Threshold"))
s:taboption("advanced", Value, "rts", translate("RTS/CTS Threshold"))
+
+ mode:value("ap-wds", "%s (%s)" % {translate("Access Point"), translate("WDS")})
+ mode:value("sta-wds", "%s (%s)" % {translate("Client"), translate("WDS")})
+
+ function mode.write(self, section, value)
+ if value == "ap-wds" then
+ ListValue.write(self, section, "ap")
+ m.uci:set("wireless", section, "wds", 1)
+ elseif value == "sta-wds" then
+ ListValue.write(self, section, "sta")
+ m.uci:set("wireless", section, "wds", 1)
+ else
+ ListValue.write(self, section, value)
+ m.uci:delete("wireless", section, "wds")
+ end
+ end
+
+ hidden = s:taboption("general", Flag, "hidden", translate("Hide <abbr title=\"Extended Service Set Identifier\">ESSID</abbr>"))
+ hidden:depends({mode="ap"})
+ hidden:depends({mode="ap-wds"})
end
mode:value("monitor", translate("Monitor"))
mode:value("ap-wds", "%s (%s)" % {translate("Access Point"), translate("WDS")})
mode:value("sta-wds", "%s (%s)" % {translate("Client"), translate("WDS")})
+ mode:value("wds", translate("Static WDS"))
function mode.write(self, section, value)
if value == "ap-wds" then
bssid:depends({mode="adhoc"})
bssid:depends({mode="ahdemo"})
+ bssid:depends({mode="wds"})
wdssep = s:taboption("advanced", Flag, "wdssep", translate("Separate WDS"))
wdssep:depends({mode="ap-wds"})
hidden:depends({mode="adhoc"})
hidden:depends({mode="ap-wds"})
hidden:depends({mode="sta-wds"})
- isolate = s:taboption("advanced", Flag, "isolate", translate("wifi_isolate"),
- translate("wifi_isolate_desc"))
+ isolate = s:taboption("advanced", Flag, "isolate", translate("Separate Clients"),
+ translate("Prevents client-to-client communication"))
isolate:depends({mode="ap"})
s:taboption("advanced", Flag, "bgscan", translate("Background Scan"))
hidden:depends({mode="adhoc"})
hidden:depends({mode="wds"})
- isolate = s:taboption("advanced", Flag, "isolate", translate("wifi_isolate"),
- translate("wifi_isolate_desc"))
+ isolate = s:taboption("advanced", Flag, "isolate", translate("Separate Clients"),
+ translate("Prevents client-to-client communication"))
isolate:depends({mode="ap"})
s:taboption("advanced", Flag, "doth", "802.11h")
encr = s:taboption("encryption", ListValue, "encryption", translate("Encryption"))
encr.override_values = true
+ encr.override_depends = true
encr:depends({mode="ap"})
encr:depends({mode="sta"})
encr:depends({mode="adhoc"})
encr:depends({mode="mesh"})
encr:value("none", "No Encryption")
- encr:value("wep", "WEP")
+ encr:value("wep", "WEP", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
local supplicant = fs.access("/usr/sbin/wpa_supplicant")
encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="ap"}, {mode="ap-wds"}, {mode="adhoc"}, {mode="ahdemo"})
encr:value("wpa", "WPA-EAP", {mode="ap"}, {mode="ap-wds"})
encr:value("wpa2", "WPA2-EAP", {mode="ap"}, {mode="ap-wds"})
- encr.description = translate("wifi_wpareq")
+ encr.description = translate(
+ "WPA-Encryption requires wpa_supplicant (for client mode) or hostapd (for AP " ..
+ "and ad-hoc mode) to be installed."
+ )
elseif not hostapd and supplicant then
encr:value("psk", "WPA-PSK", {mode="sta"}, {mode="sta-wds"})
encr:value("psk2", "WPA2-PSK", {mode="sta"}, {mode="sta-wds"})
encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="sta"}, {mode="sta-wds"})
encr:value("wpa", "WPA-EAP", {mode="sta"}, {mode="sta-wds"})
encr:value("wpa2", "WPA2-EAP", {mode="sta"}, {mode="sta-wds"})
- encr.description = translate("wifi_wpareq")
+ encr.description = translate(
+ "WPA-Encryption requires wpa_supplicant (for client mode) or hostapd (for AP " ..
+ "and ad-hoc mode) to be installed."
+ )
else
- encr.description = translate("wifi_wpareq")
+ encr.description = translate(
+ "WPA-Encryption requires wpa_supplicant (for client mode) or hostapd (for AP " ..
+ "and ad-hoc mode) to be installed."
+ )
end
elseif hwtype == "broadcom" then
encr:value("psk", "WPA-PSK")
encr:depends("mode", "sta-wds")
encr:depends("mode", "wds")
- server = s:taboption("encryption", Value, "server", translate("RadiusServer"))
+ 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"))
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
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"))