summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full/luasrc/model
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc/model')
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua26
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/ifaces.lua8
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/network.lua1
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua59
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua318
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/crontab.lua5
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua31
7 files changed, 272 insertions, 176 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
index 10636a491a..0c01ceffca 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
@@ -68,9 +68,10 @@ se = s:taboption("advanced", Flag, "sequential_ip",
translate("Allocate IP addresses sequentially, starting from the lowest available address"))
se.optional = true
-s:taboption("advanced", Flag, "boguspriv",
+bp = s:taboption("advanced", Flag, "boguspriv",
translate("Filter private"),
translate("Do not forward reverse lookups for local networks"))
+bp.default = bp.enabled
s:taboption("advanced", Flag, "filterwin2k",
translate("Filter useless"),
@@ -275,6 +276,16 @@ name = s:option(Value, "name", translate("Hostname"))
name.datatype = "hostname"
name.rmempty = true
+function name.write(self, section, value)
+ Value.write(self, section, value)
+ m:set(section, "dns", "1")
+end
+
+function name.remove(self, section)
+ Value.remove(self, section)
+ m:del(section, "dns")
+end
+
mac = s:option(Value, "mac", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address"))
mac.datatype = "list(macaddr)"
mac.rmempty = true
@@ -285,6 +296,19 @@ ip.datatype = "or(ip4addr,'ignore')"
time = s:option(Value, "leasetime", translate("Lease time"))
time.rmempty = true
+duid = s:option(Value, "duid", translate("<abbr title=\"The DHCP Unique Identifier\">DUID</abbr>"))
+duid.datatype = "and(rangelength(28,36),hexstring)"
+fp = io.open("/var/hosts/odhcpd")
+if fp then
+ for line in fp:lines() do
+ local net_val, duid_val = string.match(line, "# (%S+)%s+(%S+)")
+ if duid_val then
+ duid:value(duid_val, duid_val)
+ end
+ end
+ fp:close()
+end
+
hostid = s:option(Value, "hostid", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Suffix (hex)"))
ipc.neighbors({ family = 4 }, function(n)
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/ifaces.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/ifaces.lua
index 16a104494a..4fc71cefab 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/ifaces.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/ifaces.lua
@@ -220,6 +220,12 @@ auto.default = (net:proto() == "none") and auto.disabled or auto.enabled
delegate = s:taboption("advanced", Flag, "delegate", translate("Use builtin IPv6-management"))
delegate.default = delegate.enabled
+force_link = s:taboption("advanced", Flag, "force_link",
+ translate("Force link"),
+ translate("Set interface properties regardless of the link carrier (If set, carrier sense events do not invoke hotplug handlers)."))
+
+force_link.default = (net:proto() == "static") and force_link.enabled or force_link.disabled
+
if not net:is_virtual() then
br = s:taboption("physical", Flag, "type", translate("Bridge interfaces"), translate("creates a bridge over specified interface(s)"))
@@ -439,7 +445,7 @@ if has_dnsmasq and net:proto() == "static" then
limit.datatype = "uinteger"
limit.default = "150"
- local ltime = s:taboption("general", Value, "leasetime", translate("Leasetime"),
+ local ltime = s:taboption("general", Value, "leasetime", translate("Lease time"),
translate("Expiry time of leased addresses, minimum is 2 minutes (<code>2m</code>)."))
ltime.rmempty = true
ltime.default = "12h"
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/network.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/network.lua
index 385e1141ec..22f7c5f700 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/network.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/network.lua
@@ -38,6 +38,7 @@ if fs.access("/etc/init.d/dsl_control") then
tone:value("bv", translate("B43 + B43C + V43"))
xfer_mode = dsl:option(ListValue, "xfer_mode", translate("Encapsulation mode"))
+ xfer_mode:value("", translate("auto"))
xfer_mode:value("atm", translate("ATM (Asynchronous Transfer Mode)"))
xfer_mode:value("ptm", translate("PTM/EFM (Packet Transfer Mode)"))
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua
index 902767c903..89a73a5ca8 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua
@@ -12,6 +12,35 @@ nw.init(m.uci)
local topologies = nw:get_switch_topologies() or {}
+local update_interfaces = function(old_ifname, new_ifname)
+ local info = { }
+
+ m.uci:foreach("network", "interface", function(section)
+ local old_ifnames = m.uci:get("network", section[".name"], "ifname")
+ local new_ifnames = { }
+ local cur_ifname
+ local changed = false
+ for cur_ifname in luci.util.imatch(old_ifnames) do
+ if cur_ifname == old_ifname then
+ new_ifnames[#new_ifnames+1] = new_ifname
+ changed = true
+ else
+ new_ifnames[#new_ifnames+1] = cur_ifname
+ end
+ end
+ if changed then
+ m.uci:set("network", section[".name"], "ifname", table.concat(new_ifnames, " "))
+
+ info[#info+1] = translatef("Interface %q device auto-migrated from %q to %q.",
+ section[".name"], old_ifname, new_ifname)
+ end
+ end)
+
+ if #info > 0 then
+ m.message = (m.message and m.message .. "\n" or "") .. table.concat(info, "\n")
+ end
+end
+
m.uci:foreach("network", "switch",
function(x)
local sid = x['.name']
@@ -259,17 +288,32 @@ m.uci:foreach("network", "switch",
-- When writing the "vid" or "vlan" option, serialize the port states
-- as well and write them as "ports" option to uci.
- vid.write = function(self, section, value)
+ vid.write = function(self, section, new_vid)
local o
local p = { }
-
for _, o in ipairs(port_opts) do
- local v = o:formvalue(section)
- if v == "t" then
- p[#p+1] = o.option .. v
- elseif v == "u" then
+ local new_tag = o:formvalue(section)
+ if new_tag == "t" then
+ p[#p+1] = o.option .. new_tag
+ elseif new_tag == "u" then
p[#p+1] = o.option
end
+
+ if o.info and o.info.device then
+ local old_tag = o:cfgvalue(section)
+ local old_vid = self:cfgvalue(section)
+ if old_tag ~= new_tag or old_vid ~= new_vid then
+ local old_ifname = (old_tag == "u") and o.info.device
+ or "%s.%s" %{ o.info.device, old_vid }
+
+ local new_ifname = (new_tag == "u") and o.info.device
+ or "%s.%s" %{ o.info.device, new_vid }
+
+ if old_ifname ~= new_ifname then
+ update_interfaces(old_ifname, new_ifname)
+ end
+ end
+ end
end
if enable_vlan4k then
@@ -277,7 +321,7 @@ m.uci:foreach("network", "switch",
end
m:set(section, "ports", table.concat(p, " "))
- return Value.write(self, section, value)
+ return Value.write(self, section, new_vid)
end
-- Fallback to "vlan" option if "vid" option is supported but unset.
@@ -301,6 +345,7 @@ m.uci:foreach("network", "switch",
po.cfgvalue = portvalue
po.validate = portvalidate
po.write = function() end
+ po.info = pt
port_opts[#port_opts+1] = po
end
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua
index afe0d662b7..c64226931c 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua
@@ -248,64 +248,6 @@ if hwtype == "mac80211" then
end
-------------------- Madwifi Device ------------------
-
-if hwtype == "atheros" then
- tp = s:taboption("general",
- (#tx_power_list > 0) and ListValue or Value,
- "txpower", translate("Transmit Power"), "dBm")
-
- tp.rmempty = true
- tp.default = tx_power_cur
-
- function tp.cfgvalue(...)
- return txpower_current(Value.cfgvalue(...), tx_power_list)
- end
-
- tp:value("", translate("auto"))
- for _, p in ipairs(tx_power_list) do
- tp:value(p.driver_dbm, "%i dBm (%i mW)"
- %{ p.display_dbm, p.display_mw })
- end
-
- s:taboption("advanced", Flag, "diversity", translate("Diversity")).rmempty = false
-
- if not nsantenna then
- ant1 = s:taboption("advanced", ListValue, "txantenna", translate("Transmitter Antenna"))
- ant1.widget = "radio"
- ant1.orientation = "horizontal"
- ant1:depends("diversity", "")
- ant1:value("0", translate("auto"))
- ant1:value("1", translate("Antenna 1"))
- ant1:value("2", translate("Antenna 2"))
-
- ant2 = s:taboption("advanced", ListValue, "rxantenna", translate("Receiver Antenna"))
- ant2.widget = "radio"
- ant2.orientation = "horizontal"
- ant2:depends("diversity", "")
- ant2:value("0", translate("auto"))
- ant2:value("1", translate("Antenna 1"))
- ant2:value("2", translate("Antenna 2"))
-
- else -- NanoFoo
- local ant = s:taboption("advanced", ListValue, "antenna", translate("Transmitter Antenna"))
- ant:value("auto")
- ant:value("vertical")
- ant:value("horizontal")
- ant:value("external")
- end
-
- s:taboption("advanced", Value, "distance", translate("Distance Optimization"),
- translate("Distance to farthest network member in meters."))
- s:taboption("advanced", Value, "regdomain", translate("Regulatory Domain"))
- s:taboption("advanced", Value, "country", translate("Country Code"))
- s:taboption("advanced", Flag, "outdoor", translate("Outdoor Channels"))
-
- --s:option(Flag, "nosbeacon", translate("Disable HW-Beacon timer"))
-end
-
-
-
------------------- Broadcom Device ------------------
if hwtype == "broadcom" then
@@ -518,103 +460,14 @@ if hwtype == "mac80211" then
wmm:depends({mode="ap"})
wmm:depends({mode="ap-wds"})
wmm.default = wmm.enabled
-
- ifname = s:taboption("advanced", Value, "ifname", translate("Interface name"), translate("Override default interface name"))
- ifname.optional = true
-end
-
-
-
--------------------- Madwifi Interface ----------------------
-
-if hwtype == "atheros" then
- mode:value("ahdemo", translate("Pseudo Ad-Hoc (ahdemo)"))
- 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
- 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
- function mode.cfgvalue(self, section)
- local mode = ListValue.cfgvalue(self, section)
- local wds = m.uci:get("wireless", section, "wds") == "1"
-
- if mode == "ap" and wds then
- return "ap-wds"
- elseif mode == "sta" and wds then
- return "sta-wds"
- else
- return mode
- end
- end
-
- 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"})
-
- s:taboption("advanced", Flag, "doth", "802.11h")
- hidden = s:taboption("general", Flag, "hidden", translate("Hide <abbr title=\"Extended Service Set Identifier\">ESSID</abbr>"))
- hidden:depends({mode="ap"})
- hidden:depends({mode="adhoc"})
- hidden:depends({mode="ap-wds"})
- hidden:depends({mode="sta-wds"})
- isolate = s:taboption("advanced", Flag, "isolate", translate("Separate Clients"),
+ isolate = s:taboption("advanced", Flag, "isolate", translate("Isolate Clients"),
translate("Prevents client-to-client communication"))
isolate:depends({mode="ap"})
- s:taboption("advanced", Flag, "bgscan", translate("Background Scan"))
-
- mp = s:taboption("macfilter", ListValue, "macpolicy", translate("MAC-Address Filter"))
- mp:value("", translate("disable"))
- mp:value("allow", translate("Allow listed only"))
- mp:value("deny", translate("Allow all except listed"))
-
- ml = s:taboption("macfilter", DynamicList, "maclist", translate("MAC-List"))
- ml.datatype = "macaddr"
- ml:depends({macpolicy="allow"})
- ml:depends({macpolicy="deny"})
- nt.mac_hints(function(mac, name) ml:value(mac, "%s (%s)" %{ mac, name }) end)
-
- s:taboption("advanced", Value, "rate", translate("Transmission Rate"))
- s:taboption("advanced", Value, "mcast_rate", translate("Multicast Rate"))
- s:taboption("advanced", Value, "frag", translate("Fragmentation Threshold"))
- s:taboption("advanced", Value, "rts", translate("RTS/CTS Threshold"))
- s:taboption("advanced", Value, "minrate", translate("Minimum Rate"))
- s:taboption("advanced", Value, "maxrate", translate("Maximum Rate"))
- s:taboption("advanced", Flag, "compression", translate("Compression"))
-
- s:taboption("advanced", Flag, "bursting", translate("Frame Bursting"))
- s:taboption("advanced", Flag, "turbo", translate("Turbo Mode"))
- s:taboption("advanced", Flag, "ff", translate("Fast Frames"))
-
- s:taboption("advanced", Flag, "wmm", translate("WMM Mode"))
- s:taboption("advanced", Flag, "xr", translate("XR Support"))
- s:taboption("advanced", Flag, "ar", translate("AR Support"))
+ isolate:depends({mode="ap-wds"})
- local swm = s:taboption("advanced", Flag, "sw_merge", translate("Disable HW-Beacon timer"))
- swm:depends({mode="adhoc"})
-
- local nos = s:taboption("advanced", Flag, "nosbeacon", translate("Disable HW-Beacon timer"))
- nos:depends({mode="sta"})
- nos:depends({mode="sta-wds"})
-
- local probereq = s:taboption("advanced", Flag, "probereq", translate("Do not send probe responses"))
- probereq.enabled = "0"
- probereq.disabled = "1"
+ ifname = s:taboption("advanced", Value, "ifname", translate("Interface name"), translate("Override default interface name"))
+ ifname.optional = true
end
@@ -738,7 +591,7 @@ encr:value("none", "No Encryption")
encr:value("wep-open", translate("WEP Open System"), {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"}, {mode="ahdemo"}, {mode="wds"})
encr:value("wep-shared", translate("WEP Shared Key"), {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"}, {mode="ahdemo"}, {mode="wds"})
-if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
+if hwtype == "mac80211" or hwtype == "prism2" then
local supplicant = fs.access("/usr/sbin/wpa_supplicant")
local hostapd = fs.access("/usr/sbin/hostapd")
@@ -747,9 +600,9 @@ if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
local has_sta_eap = (os.execute("wpa_supplicant -veap >/dev/null 2>/dev/null") == 0)
if hostapd and supplicant then
- encr:value("psk", "WPA-PSK", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
- encr:value("psk2", "WPA2-PSK", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
- encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
+ encr:value("psk", "WPA-PSK", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"})
+ encr:value("psk2", "WPA2-PSK", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"})
+ encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"})
if has_ap_eap and has_sta_eap then
encr:value("wpa", "WPA-EAP", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
encr:value("wpa2", "WPA2-EAP", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
@@ -767,9 +620,9 @@ if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
"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("psk", "WPA-PSK", {mode="sta"}, {mode="sta-wds"}, {mode="adhoc"})
+ encr:value("psk2", "WPA2-PSK", {mode="sta"}, {mode="sta-wds"}, {mode="adhoc"})
+ encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="sta"}, {mode="sta-wds"}, {mode="adhoc"})
if has_sta_eap then
encr:value("wpa", "WPA-EAP", {mode="sta"}, {mode="sta-wds"})
encr:value("wpa2", "WPA2-EAP", {mode="sta"}, {mode="sta-wds"})
@@ -899,14 +752,105 @@ for slot=1,4 do
end
-if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
- nasid = s:taboption("encryption", Value, "nasid", translate("NAS ID"))
+if hwtype == "mac80211" or hwtype == "prism2" then
+
+ -- Probe 802.11r support (and EAP support as a proxy for Openwrt)
+ local has_80211r = (os.execute("hostapd -v11r 2>/dev/null || hostapd -veap 2>/dev/null") == 0)
+
+ ieee80211r = s:taboption("encryption", Flag, "ieee80211r",
+ translate("802.11r Fast Transition"),
+ translate("Enables fast roaming among access points that belong " ..
+ "to the same Mobility Domain"))
+ ieee80211r:depends({mode="ap", encryption="wpa"})
+ ieee80211r:depends({mode="ap", encryption="wpa2"})
+ ieee80211r:depends({mode="ap-wds", encryption="wpa"})
+ ieee80211r:depends({mode="ap-wds", encryption="wpa2"})
+ if has_80211r then
+ ieee80211r:depends({mode="ap", encryption="psk"})
+ ieee80211r:depends({mode="ap", encryption="psk2"})
+ ieee80211r:depends({mode="ap", encryption="psk-mixed"})
+ ieee80211r:depends({mode="ap-wds", encryption="psk"})
+ ieee80211r:depends({mode="ap-wds", encryption="psk2"})
+ ieee80211r:depends({mode="ap-wds", encryption="psk-mixed"})
+ end
+ ieee80211r.rmempty = true
+
+ nasid = s:taboption("encryption", Value, "nasid", translate("NAS ID"),
+ translate("Used for two different purposes: RADIUS NAS ID and " ..
+ "802.11r R0KH-ID. Not needed with normal WPA(2)-PSK."))
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:depends({ieee80211r="1"})
nasid.rmempty = true
+ mobility_domain = s:taboption("encryption", Value, "mobility_domain",
+ translate("Mobility Domain"),
+ translate("4-character hexadecimal ID"))
+ mobility_domain:depends({ieee80211r="1"})
+ mobility_domain.placeholder = "4f57"
+ mobility_domain.datatype = "and(hexstring,rangelength(4,4))"
+ mobility_domain.rmempty = true
+
+ reassociation_deadline = s:taboption("encryption", Value, "reassociation_deadline",
+ translate("Reassociation Deadline"),
+ translate("time units (TUs / 1.024 ms) [1000-65535]"))
+ reassociation_deadline:depends({ieee80211r="1"})
+ reassociation_deadline.placeholder = "1000"
+ reassociation_deadline.datatype = "range(1000,65535)"
+ reassociation_deadline.rmempty = true
+
+ ft_protocol = s:taboption("encryption", ListValue, "ft_over_ds", translate("FT protocol"))
+ ft_protocol:depends({ieee80211r="1"})
+ ft_protocol:value("1", translatef("FT over DS"))
+ ft_protocol:value("0", translatef("FT over the Air"))
+ ft_protocol.rmempty = true
+
+ ft_psk_generate_local = s:taboption("encryption", Flag, "ft_psk_generate_local",
+ translate("Generate PMK locally"),
+ translate("When using a PSK, the PMK can be generated locally without inter AP communications"))
+ ft_psk_generate_local:depends({ieee80211r="1"})
+
+ r0_key_lifetime = s:taboption("encryption", Value, "r0_key_lifetime",
+ translate("R0 Key Lifetime"), translate("minutes"))
+ r0_key_lifetime:depends({ieee80211r="1", ft_psk_generate_local=""})
+ r0_key_lifetime.placeholder = "10000"
+ r0_key_lifetime.datatype = "uinteger"
+ r0_key_lifetime.rmempty = true
+
+ r1_key_holder = s:taboption("encryption", Value, "r1_key_holder",
+ translate("R1 Key Holder"),
+ translate("6-octet identifier as a hex string - no colons"))
+ r1_key_holder:depends({ieee80211r="1", ft_psk_generate_local=""})
+ r1_key_holder.placeholder = "00004f577274"
+ r1_key_holder.datatype = "and(hexstring,rangelength(12,12))"
+ r1_key_holder.rmempty = true
+
+ pmk_r1_push = s:taboption("encryption", Flag, "pmk_r1_push", translate("PMK R1 Push"))
+ pmk_r1_push:depends({ieee80211r="1", ft_psk_generate_local=""})
+ pmk_r1_push.placeholder = "0"
+ pmk_r1_push.rmempty = true
+
+ r0kh = s:taboption("encryption", DynamicList, "r0kh", translate("External R0 Key Holder List"),
+ translate("List of R0KHs in the same Mobility Domain. " ..
+ "<br />Format: MAC-address,NAS-Identifier,128-bit key as hex string. " ..
+ "<br />This list is used to map R0KH-ID (NAS Identifier) to a destination " ..
+ "MAC address when requesting PMK-R1 key from the R0KH that the STA " ..
+ "used during the Initial Mobility Domain Association."))
+ r0kh:depends({ieee80211r="1", ft_psk_generate_local=""})
+ r0kh.rmempty = true
+
+ r1kh = s:taboption("encryption", DynamicList, "r1kh", translate("External R1 Key Holder List"),
+ translate ("List of R1KHs in the same Mobility Domain. "..
+ "<br />Format: MAC-address,R1KH-ID as 6 octets with colons,128-bit key as hex string. "..
+ "<br />This list is used to map R1KH-ID to a destination MAC address " ..
+ "when sending PMK-R1 key from the R0KH. This is also the " ..
+ "list of authorized R1KHs in the MD that can request PMK-R1 keys."))
+ r1kh:depends({ieee80211r="1", ft_psk_generate_local=""})
+ r1kh.rmempty = true
+ -- End of 802.11r options
+
eaptype = s:taboption("encryption", ListValue, "eap_type", translate("EAP-Method"))
eaptype:value("tls", "TLS")
eaptype:value("ttls", "TTLS")
@@ -1045,7 +989,59 @@ if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
password.password = true
end
-if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
+-- ieee802.11w options
+if hwtype == "mac80211" then
+ local has_80211w = (os.execute("hostapd -v11w 2>/dev/null || hostapd -veap 2>/dev/null") == 0)
+ if has_80211w then
+ ieee80211w = s:taboption("encryption", ListValue, "ieee80211w",
+ translate("802.11w Management Frame Protection"),
+ translate("Requires the 'full' version of wpad/hostapd " ..
+ "and support from the wifi driver <br />(as of Feb 2017: " ..
+ "ath9k and ath10k, in LEDE also mwlwifi and mt76)"))
+ ieee80211w.default = ""
+ ieee80211w.rmempty = true
+ ieee80211w:value("", translate("Disabled (default)"))
+ ieee80211w:value("1", translate("Optional"))
+ ieee80211w:value("2", translate("Required"))
+ ieee80211w:depends({mode="ap", encryption="wpa2"})
+ ieee80211w:depends({mode="ap-wds", encryption="wpa2"})
+ ieee80211w:depends({mode="ap", encryption="psk2"})
+ ieee80211w:depends({mode="ap", encryption="psk-mixed"})
+ ieee80211w:depends({mode="ap-wds", encryption="psk2"})
+ ieee80211w:depends({mode="ap-wds", encryption="psk-mixed"})
+
+ max_timeout = s:taboption("encryption", Value, "ieee80211w_max_timeout",
+ translate("802.11w maximum timeout"),
+ translate("802.11w Association SA Query maximum timeout"))
+ max_timeout:depends({ieee80211w="1"})
+ max_timeout:depends({ieee80211w="2"})
+ max_timeout.datatype = "uinteger"
+ max_timeout.placeholder = "1000"
+ max_timeout.rmempty = true
+
+ retry_timeout = s:taboption("encryption", Value, "ieee80211w_retry_timeout",
+ translate("802.11w retry timeout"),
+ translate("802.11w Association SA Query retry timeout"))
+ retry_timeout:depends({ieee80211w="1"})
+ retry_timeout:depends({ieee80211w="2"})
+ retry_timeout.datatype = "uinteger"
+ retry_timeout.placeholder = "201"
+ retry_timeout.rmempty = true
+ end
+
+ local key_retries = s:taboption("encryption", Flag, "wpa_disable_eapol_key_retries",
+ translate("Enable key reinstallation (KRACK) countermeasures"),
+ translate("Complicates key reinstallation attacks on the client side by disabling retransmission of EAPOL-Key frames that are used to install keys. This workaround might cause interoperability issues and reduced robustness of key negotiation especially in environments with heavy traffic load."))
+
+ key_retries:depends({mode="ap", encryption="wpa2"})
+ key_retries:depends({mode="ap", encryption="psk2"})
+ key_retries:depends({mode="ap", encryption="psk-mixed"})
+ key_retries:depends({mode="ap-wds", encryption="wpa2"})
+ key_retries:depends({mode="ap-wds", encryption="psk2"})
+ key_retries:depends({mode="ap-wds", encryption="psk-mixed"})
+end
+
+if hwtype == "mac80211" or hwtype == "prism2" then
local wpasupplicant = fs.access("/usr/sbin/wpa_supplicant")
local hostcli = fs.access("/usr/sbin/hostapd_cli")
if hostcli and wpasupplicant then
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/crontab.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/crontab.lua
index ea92eb98de..016a6199aa 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/crontab.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/crontab.lua
@@ -5,7 +5,10 @@
local fs = require "nixio.fs"
local cronfile = "/etc/crontabs/root"
-f = SimpleForm("crontab", translate("Scheduled Tasks"), translate("This is the system crontab in which scheduled tasks can be defined."))
+f = SimpleForm("crontab", translate("Scheduled Tasks"),
+ translate("This is the system crontab in which scheduled tasks can be defined.") ..
+ translate("<br/>Note: you need to manually restart the cron service if the " ..
+ "crontab file was empty before editing."))
t = f:field(TextValue, "crons")
t.rmempty = true
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua
index 4b6f397e6a..74e2f1a19d 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua
@@ -7,10 +7,11 @@ local sysfs_path = "/sys/class/leds/"
local leds = {}
local fs = require "nixio.fs"
-local util = require "nixio.util"
+local nu = require "nixio.util"
+local util = require "luci.util"
if fs.access(sysfs_path) then
- leds = util.consume((fs.dir(sysfs_path)))
+ leds = nu.consume((fs.dir(sysfs_path)))
end
if #leds == 0 then
@@ -110,12 +111,32 @@ function usbdev.remove(self, section)
end
-usbport = s:option(MultiValue, "ports", translate("USB Ports"))
+usbport = s:option(MultiValue, "port", translate("USB Ports"))
usbport:depends("trigger", "usbport")
usbport.rmempty = true
usbport.widget = "checkbox"
+usbport.cast = "table"
usbport.size = 1
+function usbport.valuelist(self, section)
+ local port, ports = nil, {}
+ for port in util.imatch(m.uci:get("system", section, "port")) do
+ local b, n = port:match("^usb(%d+)-port(%d+)$")
+ if not (b and n) then
+ b, n = port:match("^(%d+)-(%d+)$")
+ end
+ if b and n then
+ ports[#ports+1] = "usb%u-port%u" %{ tonumber(b), tonumber(n) }
+ end
+ end
+ return ports
+end
+
+function usbport.validate(self, value)
+ return type(value) == "string" and { value } or value
+end
+
+
for p in nixio.fs.glob("/sys/bus/usb/devices/[0-9]*/manufacturer") do
local id = p:match("%d+-%d+")
local mf = nixio.fs.readfile("/sys/bus/usb/devices/" .. id .. "/manufacturer") or "?"
@@ -123,8 +144,8 @@ for p in nixio.fs.glob("/sys/bus/usb/devices/[0-9]*/manufacturer") do
usbdev:value(id, "%s (%s - %s)" %{ id, mf, pr })
end
-for p in nixio.fs.glob("/sys/bus/usb/devices/[0-9]*") do
- local bus, port = p:match("(%d+)-(%d+)")
+for p in nixio.fs.glob("/sys/bus/usb/devices/*/usb[0-9]*-port[0-9]*") do
+ local bus, port = p:match("usb(%d+)-port(%d+)")
if bus and port then
usbport:value("usb%u-port%u" %{ tonumber(bus), tonumber(port) },
"Hub %u, Port %u" %{ tonumber(bus), tonumber(port) })