modules/admin-full: add wep-open and wep-shared support
[project/luci.git] / modules / admin-full / luasrc / model / cbi / admin_network / wifi.lua
index 8ecfdda..db11832 100644 (file)
@@ -28,10 +28,6 @@ m = Map("wireless", "",
 
 m:chain("network")
 
-m.breadcrumb = {
-       { luci.dispatcher.build_url("admin/network/wireless"), translate("Wireless Networks") }
-}
-
 local ifsection
 
 function m.on_commit(map)
@@ -59,7 +55,8 @@ m.title = ww:get_i18n(wnet)
 
 
 local iw = luci.sys.wifi.getiwinfo(arg[1])
-local tx_powers = iw.txpwrlist or { }
+local tx_powers = iw.txpwrlist  or { }
+local hw_modes  = iw.hwmodelist or { }
 
 
 s = m:section(NamedSection, arg[1], "wifi-device", translate("Device Configuration"))
@@ -77,7 +74,7 @@ back.titleref = luci.dispatcher.build_url("admin", "network", "wireless")
 
 st = s:taboption("general", DummyValue, "__status", translate("Status"))
 st.template = "admin_network/wifi_status"
-st.ifname   = arg[1]
+st.ifname   = arg[2]
 
 en = s:taboption("general", Flag, "disabled", translate("Enable device"))
 en.enabled = "0"
@@ -119,13 +116,13 @@ if hwtype == "mac80211" then
 
        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")
+       if hw_modes.b then mode:value("11b", "802.11b") end
+       if hw_modes.g then mode:value("11g", "802.11g") end
+       if hw_modes.a then mode:value("11a", "802.11a") end
 
        if htcaps then
-               mode:value("11ng", "802.11g+n")
-               mode:value("11na", "802.11a+n")
+               if hw_modes.g and hw_modes.n then mode:value("11ng", "802.11g+n") end
+               if hw_modes.a and hw_modes.n then mode:value("11na", "802.11a+n") end
 
                htmode = s:taboption("advanced", ListValue, "htmode", translate("HT mode"))
                htmode:depends("hwmode", "11na")
@@ -169,12 +166,12 @@ if hwtype == "atheros" then
 
        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("11bg", "802.11b+g")
-       mode:value("11gst", "802.11g + Turbo")
-       mode:value("11ast", "802.11a + Turbo")
+       if hw_modes.b then mode:value("11b", "802.11b") end
+       if hw_modes.g then mode:value("11g", "802.11g") end
+       if hw_modes.a then mode:value("11a", "802.11a") end
+       if hw_modes.g then mode:value("11bg", "802.11b+g") end
+       if hw_modes.g then mode:value("11gst", "802.11g + Turbo") end
+       if hw_modes.a then mode:value("11ast", "802.11a + Turbo") end
        mode:value("fh", translate("Frequency Hopping"))
 
        s:taboption("advanced", Flag, "diversity", translate("Diversity")).rmempty = false
@@ -318,7 +315,7 @@ if wnet then
                        if value == '-' then
                                value = m:formvalue(self:cbid(section) .. ".newnet")
                                if value and #value > 0 then
-                                       local n = nw:add_network(value, {type="bridge", proto="none"})
+                                       local n = nw:add_network(value, {proto="none"})
                                        if n then n:add_interface(i) end
                                else
                                        local n = i:get_network()
@@ -538,7 +535,8 @@ if wnet then
        encr:depends({mode="mesh"})
 
        encr:value("none", "No Encryption")
-       encr:value("wep", "WEP", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
+       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"})
 
        if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
                local supplicant = fs.access("/usr/sbin/wpa_supplicant")
@@ -624,9 +622,9 @@ if wnet then
                nasid.rmempty = true
 
                eaptype = s:taboption("encryption", ListValue, "eap_type", translate("EAP-Method"))
-               eaptype:value("tls")
-               eaptype:value("ttls")
-               eaptype:value("peap")
+               eaptype:value("tls",  "TLS")
+               eaptype:value("ttls", "TTLS")
+               eaptype:value("peap", "PEAP")
                eaptype:depends({mode="sta", encryption="wpa"})
                eaptype:depends({mode="sta", encryption="wpa2"})