summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-base/luasrc')
-rw-r--r--modules/luci-base/luasrc/sys/iptparser.lua36
-rw-r--r--modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua2
-rw-r--r--modules/luci-base/luasrc/tools/status.lua7
-rw-r--r--modules/luci-base/luasrc/tools/webadmin.lua2
-rw-r--r--modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm4
-rw-r--r--modules/luci-base/luasrc/view/cbi/fvalue.htm1
-rw-r--r--modules/luci-base/luasrc/view/cbi/lvalue.htm3
-rw-r--r--modules/luci-base/luasrc/view/cbi/mvalue.htm3
-rw-r--r--modules/luci-base/luasrc/view/cbi/network_ifacelist.htm12
-rw-r--r--modules/luci-base/luasrc/view/cbi/network_netlist.htm3
10 files changed, 54 insertions, 19 deletions
diff --git a/modules/luci-base/luasrc/sys/iptparser.lua b/modules/luci-base/luasrc/sys/iptparser.lua
index a9dbc30826..7ff665e7af 100644
--- a/modules/luci-base/luasrc/sys/iptparser.lua
+++ b/modules/luci-base/luasrc/sys/iptparser.lua
@@ -31,29 +31,43 @@ function IptParser.__init__( self, family )
self._family = (tonumber(family) == 6) and 6 or 4
self._rules = { }
self._chains = { }
+ self._tables = { }
+
+ local t = self._tables
+ local s = self:_supported_tables(self._family)
+
+ if s.filter then t[#t+1] = "filter" end
+ if s.nat then t[#t+1] = "nat" end
+ if s.mangle then t[#t+1] = "mangle" end
+ if s.raw then t[#t+1] = "raw" end
if self._family == 4 then
self._nulladdr = "0.0.0.0/0"
- self._tables = { "filter", "nat", "mangle", "raw" }
self._command = "iptables -t %s --line-numbers -nxvL"
else
self._nulladdr = "::/0"
- self._tables = { "filter", "mangle", "raw" }
- local ok, lines = pcall(io.lines, "/proc/net/ip6_tables_names")
- if ok and lines then
- local line
- for line in lines do
- if line == "nat" then
- self._tables = { "filter", "nat", "mangle", "raw" }
- end
- end
- end
self._command = "ip6tables -t %s --line-numbers -nxvL"
end
self:_parse_rules()
end
+function IptParser._supported_tables( self, family )
+ local tables = { }
+ local ok, lines = pcall(io.lines,
+ (family == 6) and "/proc/net/ip6_tables_names"
+ or "/proc/net/ip_tables_names")
+
+ if ok and lines then
+ local line
+ for line in lines do
+ tables[line] = true
+ end
+ end
+
+ return tables
+end
+
-- search criteria as only argument. If args is nil or an empty table then all
-- rules will be returned.
--
diff --git a/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua b/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua
index 66136903a7..465d7df3d3 100644
--- a/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua
+++ b/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua
@@ -220,6 +220,7 @@ TZ = {
{ 'Asia/Aqtau', '<+05>-5' },
{ 'Asia/Aqtobe', '<+05>-5' },
{ 'Asia/Ashgabat', '<+05>-5' },
+ { 'Asia/Atyrau', '<+05>-5' },
{ 'Asia/Baghdad', 'AST-3' },
{ 'Asia/Bahrain', 'AST-3' },
{ 'Asia/Baku', '<+04>-4' },
@@ -358,6 +359,7 @@ TZ = {
{ 'Europe/Samara', '<+04>-4' },
{ 'Europe/San Marino', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/Sarajevo', 'CET-1CEST,M3.5.0,M10.5.0/3' },
+ { 'Europe/Saratov', '<+04>-4' },
{ 'Europe/Simferopol', 'MSK-3' },
{ 'Europe/Skopje', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/Sofia', 'EET-2EEST,M3.5.0/3,M10.5.0/4' },
diff --git a/modules/luci-base/luasrc/tools/status.lua b/modules/luci-base/luasrc/tools/status.lua
index a1ecbe71d0..4da0cf984b 100644
--- a/modules/luci-base/luasrc/tools/status.lua
+++ b/modules/luci-base/luasrc/tools/status.lua
@@ -63,17 +63,18 @@ local function dhcp_leases_common(family)
if not ln then
break
else
- local iface, duid, iaid, name, ts, id, length, ip = ln:match("^# (%S+) (%S+) (%S+) (%S+) (%d+) (%S+) (%S+) (.*)")
+ local iface, duid, iaid, name, ts, id, length, ip = ln:match("^# (%S+) (%S+) (%S+) (%S+) (-?%d+) (%S+) (%S+) (.*)")
+ local expire = tonumber(ts) or 0
if ip and iaid ~= "ipv4" and family == 6 then
rv[#rv+1] = {
- expires = os.difftime(tonumber(ts) or 0, os.time()),
+ expires = (expire >= 0) and os.difftime(expire, os.time()),
duid = duid,
ip6addr = ip,
hostname = (name ~= "-") and name
}
elseif ip and iaid == "ipv4" and family == 4 then
rv[#rv+1] = {
- expires = os.difftime(tonumber(ts) or 0, os.time()),
+ expires = (expire >= 0) and os.difftime(expire, os.time()),
macaddr = duid,
ipaddr = ip,
hostname = (name ~= "-") and name
diff --git a/modules/luci-base/luasrc/tools/webadmin.lua b/modules/luci-base/luasrc/tools/webadmin.lua
index 8273175de7..106810aa03 100644
--- a/modules/luci-base/luasrc/tools/webadmin.lua
+++ b/modules/luci-base/luasrc/tools/webadmin.lua
@@ -96,7 +96,7 @@ function iface_get_network(iface)
if net.l3_device == iface or net.device == iface then
-- cross check with uci to filter out @name style aliases
local uciname = cur:get("network", net.interface, "ifname")
- if not uciname or uciname:sub(1, 1) ~= "@" then
+ if type(uciname) == "string" and uciname:sub(1,1) ~= "@" or uciname then
return net.interface
end
end
diff --git a/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm b/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm
index b3b454008f..5cb31511f6 100644
--- a/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm
+++ b/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm
@@ -28,6 +28,7 @@
<% if self.allowlocal then %>
<li style="padding:0.5em">
<input class="cbi-input-radio" data-update="click change"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "_empty") .. attr("name", cbid) .. attr("value", "") .. ifattr(checked[""], "checked", "checked")%> /> &#160;
+ <label<%=attr("for", cbid .. "_empty")%>></label>
<label<%=attr("for", cbid .. "_empty")%> style="background-color:<%=fwm.zone.get_color()%>" class="zonebadge">
<strong><%:Device%></strong>
<% if self.allowany and self.allowlocal then %>(<%:input%>)<% end %>
@@ -37,6 +38,7 @@
<% if self.allowany then %>
<li style="padding:0.5em">
<input class="cbi-input-radio" data-update="click change"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "_any") .. attr("name", cbid) .. attr("value", "*") .. ifattr(checked["*"], "checked", "checked")%> /> &#160;
+ <label<%=attr("for", cbid .. "_any")%>></label>
<label<%=attr("for", cbid .. "_any")%> style="background-color:<%=fwm.zone.get_color()%>" class="zonebadge">
<strong><%:Any zone%></strong>
<% if self.allowany and self.allowlocal then %>(<%:forward%>)<% end %>
@@ -50,6 +52,7 @@
%>
<li style="padding:0.5em">
<input class="cbi-input-radio" data-update="click change"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "." .. zone:name()) .. attr("name", cbid) .. attr("value", zone:name()) .. ifattr(checked[zone:name()], "checked", "checked")%> /> &#160;
+ <label<%=attr("for", cbid .. "." .. zone:name())%>></label>
<label<%=attr("for", cbid .. "." .. zone:name())%> style="background-color:<%=zone:get_color()%>" class="zonebadge">
<strong><%=zone:name()%>:</strong>
<%
@@ -78,6 +81,7 @@
<% if self.widget ~= "checkbox" and not self.nocreate then %>
<li style="padding:0.5em">
<input class="cbi-input-radio" data-update="click change" type="radio"<%=attr("id", cbid .. "_new") .. attr("name", cbid) .. attr("value", "-") .. ifattr(not selected, "checked", "checked")%> /> &#160;
+ <label<%=attr("for", cbid .. "_new")%>></label>
<div onclick="document.getElementById('<%=cbid%>_new').checked=true" class="zonebadge" style="background-color:<%=fwm.zone.get_color()%>">
<em><%:unspecified -or- create:%>&#160;</em>
<input type="text"<%=attr("name", cbid .. ".newzone") .. ifattr(not selected, "value", luci.http.formvalue(cbid .. ".newzone") or self.default)%> onfocus="document.getElementById('<%=cbid%>_new').checked=true" />
diff --git a/modules/luci-base/luasrc/view/cbi/fvalue.htm b/modules/luci-base/luasrc/view/cbi/fvalue.htm
index 5eddcf22a1..197d03cf31 100644
--- a/modules/luci-base/luasrc/view/cbi/fvalue.htm
+++ b/modules/luci-base/luasrc/view/cbi/fvalue.htm
@@ -6,4 +6,5 @@
attr("id", cbid) .. attr("name", cbid) .. attr("value", self.enabled or 1) ..
ifattr((self:cfgvalue(section) or self.default) == self.enabled, "checked", "checked")
%> />
+ <label<%= attr("for", cbid)%>></label>
<%+cbi/valuefooter%>
diff --git a/modules/luci-base/luasrc/view/cbi/lvalue.htm b/modules/luci-base/luasrc/view/cbi/lvalue.htm
index 99f456dc54..34d02eeca0 100644
--- a/modules/luci-base/luasrc/view/cbi/lvalue.htm
+++ b/modules/luci-base/luasrc/view/cbi/lvalue.htm
@@ -24,15 +24,16 @@
<div>
<% for i, key in pairs(self.keylist) do %>
<label<%=
- attr("id", cbid.."-"..key) ..
attr("data-index", i) ..
attr("data-depends", self:deplist2json(section, self.deplist[i]))
%>>
<input class="cbi-input-radio" data-update="click change" type="radio"<%=
+ attr("id", cbid.."-"..key) ..
attr("name", cbid) ..
attr("value", key) ..
ifattr((self:cfgvalue(section) or self.default) == key, "checked", "checked")
%> />
+ <label<%= attr("for", cbid.."-"..key)%>></label>
<%=pcdata(self.vallist[i])%>
</label>
<% if i == self.size then write(br) end %>
diff --git a/modules/luci-base/luasrc/view/cbi/mvalue.htm b/modules/luci-base/luasrc/view/cbi/mvalue.htm
index ca7b94c15e..246ef43aad 100644
--- a/modules/luci-base/luasrc/view/cbi/mvalue.htm
+++ b/modules/luci-base/luasrc/view/cbi/mvalue.htm
@@ -24,15 +24,16 @@
<div>
<% for i, key in pairs(self.keylist) do %>
<label<%=
- attr("id", cbid.."-"..key) ..
attr("data-index", i) ..
attr("data-depends", self:deplist2json(section, self.deplist[i]))
%>>
<input class="cbi-input-checkbox" type="checkbox" data-update="click change"<%=
+ attr("id", cbid.."-"..key) ..
attr("name", cbid) ..
attr("value", key) ..
ifattr(luci.util.contains(v, key), "checked", "checked")
%> />
+ <label<%= attr("for", cbid.."-"..key)%>></label>
<%=pcdata(self.vallist[i])%>
</label>
<% if i == self.size then write('<br />') end %>
diff --git a/modules/luci-base/luasrc/view/cbi/network_ifacelist.htm b/modules/luci-base/luasrc/view/cbi/network_ifacelist.htm
index db6112992a..62dbde7dd4 100644
--- a/modules/luci-base/luasrc/view/cbi/network_ifacelist.htm
+++ b/modules/luci-base/luasrc/view/cbi/network_ifacelist.htm
@@ -46,7 +46,11 @@
attr("id", cbid .. "." .. iface:name()) ..
attr("name", cbid) .. attr("value", iface:name()) ..
ifattr(checked[iface:name()], "checked", "checked")
- %> /> &#160;
+ %> />
+ <%- if not self.widget or self.widget == "checkbox" or self.widget == "radio" then -%>
+ <label<%=attr("for", cbid .. "." .. iface:name())%>></label>
+ <%- end -%>
+ &#160;
<label<%=attr("for", cbid .. "." .. iface:name())%>>
<% if link then -%><a href="<%=link%>"><% end -%>
<img<%=attr("title", iface:get_i18n())%> style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" />
@@ -68,7 +72,11 @@
attr("id", cbid .. "_custom") ..
attr("name", cbid) ..
attr("value", " ")
- %> /> &#160;
+ %> />
+ <%- if not self.widget or self.widget == "checkbox" or self.widget == "radio" then -%>
+ <label<%=attr("for", cbid .. "_custom")%>></label>
+ <%- end -%>
+ &#160;
<label<%=attr("for", cbid .. "_custom")%>>
<img title="<%:Custom Interface%>" style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/ethernet_disabled.png" />
<%:Custom Interface%>:
diff --git a/modules/luci-base/luasrc/view/cbi/network_netlist.htm b/modules/luci-base/luasrc/view/cbi/network_netlist.htm
index f8a2b72f3c..8bf1a70a20 100644
--- a/modules/luci-base/luasrc/view/cbi/network_netlist.htm
+++ b/modules/luci-base/luasrc/view/cbi/network_netlist.htm
@@ -52,6 +52,9 @@
<% if not self.nocreate then %>
<li style="padding:0.25em 0">
<input class="cbi-input-<%=self.widget or "radio"%>" data-update="click change"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "_new") .. attr("name", cbid) .. attr("value", "-") .. ifattr(not value and self.widget ~= "checkbox", "checked", "checked")%> /> &#160;
+ <%- if not self.widget or self.widget == "checkbox" or self.widget == "radio" then -%>
+ <label<%=attr("for", cbid .. "_new")%>></label>
+ <%- end -%>
<div style="padding:0.5em; display:inline">
<label<%=attr("for", cbid .. "_new")%>><em>
<%- if self.widget == "checkbox" then -%>