X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fadmin-full%2Fluasrc%2Fmodel%2Fcbi%2Fadmin_network%2Fwifi.lua;h=d6abfd6ad171a59084f8ee08a63a1fa12c65f181;hp=0ad4362c0b6625ba6a97ea22b3bd51dd5209ee30;hb=fc962c347c29cc9bb20d8587217f411035224201;hpb=b50e08149c4e3dff9c5ebc6f3448a56f508d8d1c;ds=sidebyside 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 0ad4362c0..d6abfd6ad 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua @@ -20,7 +20,12 @@ local fs = require "nixio.fs" 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 Device Configuration 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 Interface Configuration.")) + m:chain("network") local ifsection @@ -38,6 +43,16 @@ end 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 @@ -50,7 +65,7 @@ m.uci:foreach("wireless", "wifi-iface", 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")) @@ -80,8 +95,8 @@ local nsantenna = m:get(arg[1], "antenna") 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 @@ -220,7 +235,7 @@ end 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 @@ -241,7 +256,11 @@ if wnet then bssid = s:taboption("general", Value, "bssid", translate("BSSID")) - 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 unspecified to not attach any network or fill out the " .. + "create field to define a new network.")) + network.rmempty = true network.template = "cbi/network_netlist" network.widget = "radio" @@ -292,6 +311,7 @@ if wnet then 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 @@ -321,6 +341,7 @@ if wnet 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"}) @@ -427,6 +448,7 @@ if wnet then 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"}) @@ -436,7 +458,7 @@ if wnet then 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") @@ -489,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")) @@ -504,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 @@ -511,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"))