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/model/network.lua184
-rw-r--r--modules/luci-base/luasrc/sys/iptparser.lua11
-rw-r--r--modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua112
-rw-r--r--modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua48
-rw-r--r--modules/luci-base/luasrc/tools/status.lua17
-rw-r--r--modules/luci-base/luasrc/util.lua38
-rw-r--r--modules/luci-base/luasrc/view/sysauth.htm8
7 files changed, 249 insertions, 169 deletions
diff --git a/modules/luci-base/luasrc/model/network.lua b/modules/luci-base/luasrc/model/network.lua
index 81fc416fe..2d8336bf3 100644
--- a/modules/luci-base/luasrc/model/network.lua
+++ b/modules/luci-base/luasrc/model/network.lua
@@ -22,7 +22,7 @@ module "luci.model.network"
IFACE_PATTERNS_VIRTUAL = { }
-IFACE_PATTERNS_IGNORE = { "^wmaster%d", "^wifi%d", "^hwsim%d", "^imq%d", "^ifb%d", "^mon%.wlan%d", "^sit%d", "^gre%d", "^lo$" }
+IFACE_PATTERNS_IGNORE = { "^wmaster%d", "^wifi%d", "^hwsim%d", "^imq%d", "^ifb%d", "^mon%.wlan%d", "^sit%d", "^gre%d", "^gretap%d", "^ip6gre%d", "^ip6tnl%d", "^tunl%d", "^lo$" }
IFACE_PATTERNS_WIRELESS = { "^wlan%d", "^wl%d", "^ath%d", "^%w+%.network%d" }
@@ -30,7 +30,7 @@ protocol = utl.class()
local _protocols = { }
-local _interfaces, _bridge, _switch, _tunnel
+local _interfaces, _bridge, _switch, _tunnel, _swtopo
local _ubusnetcache, _ubusdevcache, _ubuswificache
local _uci
@@ -190,10 +190,9 @@ function _iface_ignore(x)
return true
end
end
- return _iface_virtual(x)
+ return false
end
-
function init(cursor)
_uci = cursor or _uci or uci.cursor()
@@ -201,6 +200,7 @@ function init(cursor)
_bridge = { }
_switch = { }
_tunnel = { }
+ _swtopo = { }
_ubusnetcache = { }
_ubusdevcache = { }
@@ -210,13 +210,12 @@ function init(cursor)
local n, i
for n, i in ipairs(nxo.getifaddrs()) do
local name = i.name:match("[^:]+")
- local prnt = name:match("^([^%.]+)%.")
if _iface_virtual(name) then
_tunnel[name] = true
end
- if _tunnel[name] or not _iface_ignore(name) then
+ if _tunnel[name] or not (_iface_ignore(name) or _iface_virtual(name)) then
_interfaces[name] = _interfaces[name] or {
idx = i.ifindex or n,
name = name,
@@ -226,11 +225,6 @@ function init(cursor)
ip6addrs = { }
}
- if prnt then
- _switch[name] = true
- _switch[prnt] = true
- end
-
if i.family == "packet" then
_interfaces[name].flags = i.flags
_interfaces[name].stats = i.data
@@ -266,6 +260,79 @@ function init(cursor)
end
end
+ -- read switch topology
+ local boardinfo = jsc.parse(nfs.readfile("/etc/board.json") or "")
+ if type(boardinfo) == "table" and type(boardinfo.switch) == "table" then
+ local switch, layout
+ for switch, layout in pairs(boardinfo.switch) do
+ if type(layout) == "table" and type(layout.ports) == "table" then
+ local _, port
+ local ports = { }
+ local nports = { }
+ local netdevs = { }
+
+ for _, port in ipairs(layout.ports) do
+ if type(port) == "table" and
+ type(port.num) == "number" and
+ (type(port.role) == "string" or
+ type(port.device) == "string")
+ then
+ local spec = {
+ num = port.num,
+ role = port.role or "cpu",
+ index = port.index or port.num
+ }
+
+ if port.device then
+ spec.device = port.device
+ spec.tagged = port.need_tag
+ netdevs[tostring(port.num)] = port.device
+ end
+
+ ports[#ports+1] = spec
+
+ if port.role then
+ nports[port.role] = (nports[port.role] or 0) + 1
+ end
+ end
+ end
+
+ table.sort(ports, function(a, b)
+ if a.role ~= b.role then
+ return (a.role < b.role)
+ end
+
+ return (a.index < b.index)
+ end)
+
+ local pnum, role
+ for _, port in ipairs(ports) do
+ if port.role ~= role then
+ role = port.role
+ pnum = 1
+ end
+
+ if role == "cpu" then
+ port.label = "CPU (%s)" % port.device
+ elseif nports[role] > 1 then
+ port.label = "%s %d" %{ role:upper(), pnum }
+ pnum = pnum + 1
+ else
+ port.label = role:upper()
+ end
+
+ port.role = nil
+ port.index = nil
+ end
+
+ _swtopo[switch] = {
+ ports = ports,
+ netdevs = netdevs
+ }
+ end
+ end
+ end
+
return _M
end
@@ -474,41 +541,23 @@ function get_interface(self, i)
end
end
-local function swdev_from_board_json()
- local boardinfo = jsc.parse(nfs.readfile("/etc/board.json") or "")
- if type(boardinfo) == "table" and type(boardinfo.network) == "table" then
- local net, val
- for net, val in pairs(boardinfo.network) do
- if type(val) == "table" and type(val.ifname) == "string" and
- val.create_vlan == true
- then
- return val.ifname
- end
- end
- end
- return nil
-end
-
function get_interfaces(self)
local iface
local ifaces = { }
- local seen = { }
local nfs = { }
- local baseof = { }
-- find normal interfaces
_uci:foreach("network", "interface",
function(s)
for iface in utl.imatch(s.ifname) do
- if not _iface_ignore(iface) and not _wifi_iface(iface) then
- seen[iface] = true
+ if not _iface_ignore(iface) and not _iface_virtual(iface) and not _wifi_iface(iface) then
nfs[iface] = interface(iface)
end
end
end)
for iface in utl.kspairs(_interfaces) do
- if not (seen[iface] or _iface_ignore(iface) or _wifi_iface(iface)) then
+ if not (nfs[iface] or _iface_ignore(iface) or _iface_virtual(iface) or _wifi_iface(iface)) then
nfs[iface] = interface(iface)
end
end
@@ -516,34 +565,32 @@ function get_interfaces(self)
-- find vlan interfaces
_uci:foreach("network", "switch_vlan",
function(s)
- if not s.device then
+ if type(s.ports) ~= "string" or
+ type(s.device) ~= "string" or
+ type(_swtopo[s.device]) ~= "table"
+ then
return
end
- local base = baseof[s.device]
- if not base then
- if not s.device:match("^eth%d") then
- local l
- for l in utl.execi("swconfig dev %q help 2>/dev/null" % s.device) do
- if not base then
- base = l:match("^%w+: (%w+)")
- end
+ local pnum, ptag
+ for pnum, ptag in s.ports:gmatch("(%d+)([tu]?)") do
+ local netdev = _swtopo[s.device].netdevs[pnum]
+ if netdev then
+ if not nfs[netdev] then
+ nfs[netdev] = interface(netdev)
end
- if not base or not base:match("^eth%d") then
- base = swdev_from_board_json() or "eth0"
+ _switch[netdev] = true
+
+ if ptag == "t" then
+ local vid = tonumber(s.vid or s.vlan)
+ if vid ~= nil and vid >= 0 and vid <= 4095 then
+ local iface = "%s.%d" %{ netdev, vid }
+ if not nfs[iface] then
+ nfs[iface] = interface(iface)
+ end
+ _switch[iface] = true
+ end
end
- else
- base = s.device
- end
- baseof[s.device] = base
- end
-
- local vid = tonumber(s.vid or s.vlan)
- if vid ~= nil and vid >= 0 and vid <= 4095 then
- local iface = "%s.%d" %{ base, vid }
- if not seen[iface] then
- seen[iface] = true
- nfs[iface] = interface(iface)
end
end
end)
@@ -666,8 +713,8 @@ function get_status_by_address(self, addr)
end
function get_wannet(self)
- local net = self:get_status_by_route("0.0.0.0", 0)
- return net and network(net)
+ local net, stat = self:get_status_by_route("0.0.0.0", 0)
+ return net and network(net, stat.proto)
end
function get_wandev(self)
@@ -676,8 +723,8 @@ function get_wandev(self)
end
function get_wan6net(self)
- local net = self:get_status_by_route("::", 0)
- return net and network(net)
+ local net, stat = self:get_status_by_route("::", 0)
+ return net and network(net, stat.proto)
end
function get_wan6dev(self)
@@ -685,6 +732,10 @@ function get_wan6dev(self)
return stat and interface(stat.l3_device or stat.device)
end
+function get_switch_topologies(self)
+ return _swtopo
+end
+
function network(name, proto)
if name then
@@ -1140,10 +1191,7 @@ end
function interface.shortname(self)
if self.wif then
- return "%s %q" %{
- self.wif:active_mode(),
- self.wif:active_ssid() or self.wif:active_bssid()
- }
+ return self.wif:shortname()
else
return self.ifname
end
@@ -1154,7 +1202,7 @@ function interface.get_i18n(self)
return "%s: %s %q" %{
lng.translate("Wireless Network"),
self.wif:active_mode(),
- self.wif:active_ssid() or self.wif:active_bssid()
+ self.wif:active_ssid() or self.wif:active_bssid() or self.wif:id()
}
else
return "%s: %q" %{ self:get_type_i18n(), self:name() }
@@ -1170,7 +1218,11 @@ function interface.get_type_i18n(self)
elseif x == "switch" then
return lng.translate("Ethernet Switch")
elseif x == "vlan" then
- return lng.translate("VLAN Interface")
+ if _switch[self.ifname] then
+ return lng.translate("Switch VLAN")
+ else
+ return lng.translate("Software VLAN")
+ end
elseif x == "tunnel" then
return lng.translate("Tunnel Interface")
else
@@ -1593,7 +1645,7 @@ end
function wifinet.shortname(self)
return "%s %q" %{
lng.translate(self:active_mode()),
- self:active_ssid() or self:active_bssid()
+ self:active_ssid() or self:active_bssid() or self:id()
}
end
@@ -1601,7 +1653,7 @@ function wifinet.get_i18n(self)
return "%s: %s %q (%s)" %{
lng.translate("Wireless Network"),
lng.translate(self:active_mode()),
- self:active_ssid() or self:active_bssid(),
+ self:active_ssid() or self:active_bssid() or self:id(),
self:ifname()
}
end
diff --git a/modules/luci-base/luasrc/sys/iptparser.lua b/modules/luci-base/luasrc/sys/iptparser.lua
index 2b81e0ee3..a9dbc3082 100644
--- a/modules/luci-base/luasrc/sys/iptparser.lua
+++ b/modules/luci-base/luasrc/sys/iptparser.lua
@@ -19,6 +19,8 @@ luci.util = require "luci.util"
luci.sys = require "luci.sys"
luci.ip = require "luci.ip"
+local pcall = pcall
+local io = require "io"
local tonumber, ipairs, table = tonumber, ipairs, table
module("luci.sys.iptparser")
@@ -37,6 +39,15 @@ function IptParser.__init__( self, family )
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
diff --git a/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua b/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua
index 1efe6dd9f..465d7df3d 100644
--- a/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua
+++ b/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua
@@ -87,7 +87,7 @@ TZ = {
{ 'America/Cambridge Bay', 'MST7MDT,M3.2.0,M11.1.0' },
{ 'America/Campo Grande', 'AMT4AMST,M10.3.0/0,M2.3.0/0' },
{ 'America/Cancun', 'EST5' },
- { 'America/Caracas', 'VET4:30' },
+ { 'America/Caracas', 'VET4' },
{ 'America/Cayenne', 'GFT3' },
{ 'America/Cayman', 'EST5' },
{ 'America/Chicago', 'CST6CDT,M3.2.0,M11.1.0' },
@@ -168,7 +168,7 @@ TZ = {
{ 'America/Paramaribo', 'SRT3' },
{ 'America/Phoenix', 'MST7' },
{ 'America/Port of Spain', 'AST4' },
- { 'America/Port-au-Prince', 'EST5EDT,M3.2.0,M11.1.0' },
+ { 'America/Port-au-Prince', 'EST5' },
{ 'America/Porto Velho', 'AMT4' },
{ 'America/Puerto Rico', 'AST4' },
{ 'America/Rainy River', 'CST6CDT,M3.2.0,M11.1.0' },
@@ -178,7 +178,7 @@ TZ = {
{ 'America/Resolute', 'CST6CDT,M3.2.0,M11.1.0' },
{ 'America/Rio Branco', 'ACT5' },
{ 'America/Santarem', 'BRT3' },
- { 'America/Santiago', 'CLT3' },
+ { 'America/Santiago', 'CLT4CLST,M8.2.6/24,M5.2.6/24' },
{ 'America/Santo Domingo', 'AST4' },
{ 'America/Sao Paulo', 'BRT3BRST,M10.3.0/0,M2.3.0/0' },
{ 'America/Scoresbysund', 'EGT1EGST,M3.5.0/0,M10.5.0/1' },
@@ -201,96 +201,100 @@ TZ = {
{ 'America/Winnipeg', 'CST6CDT,M3.2.0,M11.1.0' },
{ 'America/Yakutat', 'AKST9AKDT,M3.2.0,M11.1.0' },
{ 'America/Yellowknife', 'MST7MDT,M3.2.0,M11.1.0' },
- { 'Antarctica/Casey', 'AWST-8' },
- { 'Antarctica/Davis', 'DAVT-7' },
- { 'Antarctica/DumontDUrville', 'DDUT-10' },
+ { 'Antarctica/Casey', '<+11>-11' },
+ { 'Antarctica/Davis', '<+07>-7' },
+ { 'Antarctica/DumontDUrville', '<+10>-10' },
{ 'Antarctica/Macquarie', 'MIST-11' },
- { 'Antarctica/Mawson', 'MAWT-5' },
+ { 'Antarctica/Mawson', '<+05>-5' },
{ 'Antarctica/McMurdo', 'NZST-12NZDT,M9.5.0,M4.1.0/3' },
- { 'Antarctica/Palmer', 'CLT3' },
- { 'Antarctica/Rothera', 'ROTT3' },
- { 'Antarctica/Syowa', 'SYOT-3' },
- { 'Antarctica/Troll', 'UTC0CEST-2,M3.5.0/1,M10.5.0/3' },
- { 'Antarctica/Vostok', 'VOST-6' },
+ { 'Antarctica/Palmer', 'CLT4CLST,M8.2.6/24,M5.2.6/24' },
+ { 'Antarctica/Rothera', '<-03>3' },
+ { 'Antarctica/Syowa', '<+03>-3' },
+ { 'Antarctica/Troll', '<+00>0<+02>-2,M3.5.0/1,M10.5.0/3' },
+ { 'Antarctica/Vostok', '<+06>-6' },
{ 'Arctic/Longyearbyen', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Asia/Aden', 'AST-3' },
- { 'Asia/Almaty', 'ALMT-6' },
+ { 'Asia/Almaty', '<+06>-6' },
{ 'Asia/Amman', 'EET-2EEST,M3.5.4/24,M10.5.5/1' },
- { 'Asia/Anadyr', 'ANAT-12' },
- { 'Asia/Aqtau', 'AQTT-5' },
- { 'Asia/Aqtobe', 'AQTT-5' },
- { 'Asia/Ashgabat', 'TMT-5' },
+ { 'Asia/Anadyr', '<+12>-12' },
+ { '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', 'AZT-4AZST,M3.5.0/4,M10.5.0/5' },
+ { 'Asia/Baku', '<+04>-4' },
{ 'Asia/Bangkok', 'ICT-7' },
+ { 'Asia/Barnaul', '<+07>-7' },
{ 'Asia/Beirut', 'EET-2EEST,M3.5.0/0,M10.5.0/0' },
- { 'Asia/Bishkek', 'KGT-6' },
+ { 'Asia/Bishkek', '<+06>-6' },
{ 'Asia/Brunei', 'BNT-8' },
- { 'Asia/Chita', 'YAKT-9' },
+ { 'Asia/Chita', '<+09>-9' },
{ 'Asia/Choibalsan', 'CHOT-8CHOST,M3.5.6,M9.5.6/0' },
- { 'Asia/Colombo', 'IST-5:30' },
+ { 'Asia/Colombo', '<+0530>-5:30' },
{ 'Asia/Damascus', 'EET-2EEST,M3.5.5/0,M10.5.5/0' },
{ 'Asia/Dhaka', 'BDT-6' },
{ 'Asia/Dili', 'TLT-9' },
{ 'Asia/Dubai', 'GST-4' },
- { 'Asia/Dushanbe', 'TJT-5' },
- { 'Asia/Gaza', 'EET-2EEST,M3.5.5/24,M10.3.6/144' },
- { 'Asia/Hebron', 'EET-2EEST,M3.5.5/24,M10.3.6/144' },
+ { 'Asia/Dushanbe', '<+05>-5' },
+ { 'Asia/Famagusta', '<+03>-3' },
+ { 'Asia/Gaza', 'EET-2EEST,M3.5.6/1,M10.5.6/1' },
+ { 'Asia/Hebron', 'EET-2EEST,M3.5.6/1,M10.5.6/1' },
{ 'Asia/Ho Chi Minh', 'ICT-7' },
{ 'Asia/Hong Kong', 'HKT-8' },
{ 'Asia/Hovd', 'HOVT-7HOVST,M3.5.6,M9.5.6/0' },
- { 'Asia/Irkutsk', 'IRKT-8' },
+ { 'Asia/Irkutsk', '<+08>-8' },
{ 'Asia/Jakarta', 'WIB-7' },
{ 'Asia/Jayapura', 'WIT-9' },
{ 'Asia/Jerusalem', 'IST-2IDT,M3.4.4/26,M10.5.0' },
{ 'Asia/Kabul', 'AFT-4:30' },
- { 'Asia/Kamchatka', 'PETT-12' },
+ { 'Asia/Kamchatka', '<+12>-12' },
{ 'Asia/Karachi', 'PKT-5' },
{ 'Asia/Kathmandu', 'NPT-5:45' },
- { 'Asia/Khandyga', 'YAKT-9' },
+ { 'Asia/Khandyga', '<+09>-9' },
{ 'Asia/Kolkata', 'IST-5:30' },
- { 'Asia/Krasnoyarsk', 'KRAT-7' },
+ { 'Asia/Krasnoyarsk', '<+07>-7' },
{ 'Asia/Kuala Lumpur', 'MYT-8' },
{ 'Asia/Kuching', 'MYT-8' },
{ 'Asia/Kuwait', 'AST-3' },
{ 'Asia/Macau', 'CST-8' },
- { 'Asia/Magadan', 'MAGT-10' },
+ { 'Asia/Magadan', '<+11>-11' },
{ 'Asia/Makassar', 'WITA-8' },
{ 'Asia/Manila', 'PHT-8' },
{ 'Asia/Muscat', 'GST-4' },
{ 'Asia/Nicosia', 'EET-2EEST,M3.5.0/3,M10.5.0/4' },
- { 'Asia/Novokuznetsk', 'KRAT-7' },
- { 'Asia/Novosibirsk', 'NOVT-6' },
- { 'Asia/Omsk', 'OMST-6' },
- { 'Asia/Oral', 'ORAT-5' },
+ { 'Asia/Novokuznetsk', '<+07>-7' },
+ { 'Asia/Novosibirsk', '<+07>-7' },
+ { 'Asia/Omsk', '<+06>-6' },
+ { 'Asia/Oral', '<+05>-5' },
{ 'Asia/Phnom Penh', 'ICT-7' },
{ 'Asia/Pontianak', 'WIB-7' },
{ 'Asia/Pyongyang', 'KST-8:30' },
{ 'Asia/Qatar', 'AST-3' },
- { 'Asia/Qyzylorda', 'QYZT-6' },
- { 'Asia/Rangoon', 'MMT-6:30' },
+ { 'Asia/Qyzylorda', '<+06>-6' },
{ 'Asia/Riyadh', 'AST-3' },
- { 'Asia/Sakhalin', 'SAKT-10' },
- { 'Asia/Samarkand', 'UZT-5' },
+ { 'Asia/Sakhalin', '<+11>-11' },
+ { 'Asia/Samarkand', '<+05>-5' },
{ 'Asia/Seoul', 'KST-9' },
{ 'Asia/Shanghai', 'CST-8' },
{ 'Asia/Singapore', 'SGT-8' },
- { 'Asia/Srednekolymsk', 'SRET-11' },
+ { 'Asia/Srednekolymsk', '<+11>-11' },
{ 'Asia/Taipei', 'CST-8' },
- { 'Asia/Tashkent', 'UZT-5' },
- { 'Asia/Tbilisi', 'GET-4' },
+ { 'Asia/Tashkent', '<+05>-5' },
+ { 'Asia/Tbilisi', '<+04>-4' },
{ 'Asia/Tehran', 'IRST-3:30IRDT,J80/0,J264/0' },
{ 'Asia/Thimphu', 'BTT-6' },
{ 'Asia/Tokyo', 'JST-9' },
+ { 'Asia/Tomsk', '<+07>-7' },
{ 'Asia/Ulaanbaatar', 'ULAT-8ULAST,M3.5.6,M9.5.6/0' },
{ 'Asia/Urumqi', 'XJT-6' },
- { 'Asia/Ust-Nera', 'VLAT-10' },
+ { 'Asia/Ust-Nera', '<+10>-10' },
{ 'Asia/Vientiane', 'ICT-7' },
- { 'Asia/Vladivostok', 'VLAT-10' },
- { 'Asia/Yakutsk', 'YAKT-9' },
- { 'Asia/Yekaterinburg', 'YEKT-5' },
- { 'Asia/Yerevan', 'AMT-4' },
+ { 'Asia/Vladivostok', '<+10>-10' },
+ { 'Asia/Yakutsk', '<+09>-9' },
+ { 'Asia/Yangon', 'MMT-6:30' },
+ { 'Asia/Yekaterinburg', '<+05>-5' },
+ { 'Asia/Yerevan', '<+04>-4' },
{ 'Atlantic/Azores', 'AZOT1AZOST,M3.5.0/0,M10.5.0/1' },
{ 'Atlantic/Bermuda', 'AST4ADT,M3.2.0,M11.1.0' },
{ 'Atlantic/Canary', 'WET0WEST,M3.5.0/1,M10.5.0' },
@@ -315,6 +319,7 @@ TZ = {
{ 'Australia/Sydney', 'AEST-10AEDT,M10.1.0,M4.1.0/3' },
{ 'Europe/Amsterdam', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/Andorra', 'CET-1CEST,M3.5.0,M10.5.0/3' },
+ { 'Europe/Astrakhan', '<+04>-4' },
{ 'Europe/Athens', 'EET-2EEST,M3.5.0/3,M10.5.0/4' },
{ 'Europe/Belgrade', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/Berlin', 'CET-1CEST,M3.5.0,M10.5.0/3' },
@@ -330,10 +335,11 @@ TZ = {
{ 'Europe/Guernsey', 'GMT0BST,M3.5.0/1,M10.5.0' },
{ 'Europe/Helsinki', 'EET-2EEST,M3.5.0/3,M10.5.0/4' },
{ 'Europe/Isle of Man', 'GMT0BST,M3.5.0/1,M10.5.0' },
- { 'Europe/Istanbul', 'EET-2EEST,M3.5.0/3,M10.5.0/4' },
+ { 'Europe/Istanbul', '<+03>-3' },
{ 'Europe/Jersey', 'GMT0BST,M3.5.0/1,M10.5.0' },
{ 'Europe/Kaliningrad', 'EET-2' },
{ 'Europe/Kiev', 'EET-2EEST,M3.5.0/3,M10.5.0/4' },
+ { 'Europe/Kirov', '<+03>-3' },
{ 'Europe/Lisbon', 'WET0WEST,M3.5.0/1,M10.5.0' },
{ 'Europe/Ljubljana', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/London', 'GMT0BST,M3.5.0/1,M10.5.0' },
@@ -341,7 +347,7 @@ TZ = {
{ 'Europe/Madrid', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/Malta', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/Mariehamn', 'EET-2EEST,M3.5.0/3,M10.5.0/4' },
- { 'Europe/Minsk', 'MSK-3' },
+ { 'Europe/Minsk', '<+03>-3' },
{ 'Europe/Monaco', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/Moscow', 'MSK-3' },
{ 'Europe/Oslo', 'CET-1CEST,M3.5.0,M10.5.0/3' },
@@ -350,21 +356,23 @@ TZ = {
{ 'Europe/Prague', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/Riga', 'EET-2EEST,M3.5.0/3,M10.5.0/4' },
{ 'Europe/Rome', 'CET-1CEST,M3.5.0,M10.5.0/3' },
- { 'Europe/Samara', 'SAMT-4' },
+ { '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' },
{ 'Europe/Stockholm', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/Tallinn', 'EET-2EEST,M3.5.0/3,M10.5.0/4' },
{ 'Europe/Tirane', 'CET-1CEST,M3.5.0,M10.5.0/3' },
+ { 'Europe/Ulyanovsk', '<+04>-4' },
{ 'Europe/Uzhgorod', 'EET-2EEST,M3.5.0/3,M10.5.0/4' },
{ 'Europe/Vaduz', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/Vatican', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/Vienna', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/Vilnius', 'EET-2EEST,M3.5.0/3,M10.5.0/4' },
- { 'Europe/Volgograd', 'MSK-3' },
+ { 'Europe/Volgograd', '<+03>-3' },
{ 'Europe/Warsaw', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/Zagreb', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Europe/Zaporozhye', 'EET-2EEST,M3.5.0/3,M10.5.0/4' },
@@ -374,7 +382,7 @@ TZ = {
{ 'Indian/Christmas', 'CXT-7' },
{ 'Indian/Cocos', 'CCT-6:30' },
{ 'Indian/Comoro', 'EAT-3' },
- { 'Indian/Kerguelen', 'TFT-5' },
+ { 'Indian/Kerguelen', '<+05>-5' },
{ 'Indian/Mahe', 'SCT-4' },
{ 'Indian/Maldives', 'MVT-5' },
{ 'Indian/Mauritius', 'MUT-4' },
@@ -385,7 +393,7 @@ TZ = {
{ 'Pacific/Bougainville', 'BST-11' },
{ 'Pacific/Chatham', 'CHAST-12:45CHADT,M9.5.0/2:45,M4.1.0/3:45' },
{ 'Pacific/Chuuk', 'CHUT-10' },
- { 'Pacific/Easter', 'EAST5' },
+ { 'Pacific/Easter', 'EAST6EASST,M8.2.6/22,M5.2.6/22' },
{ 'Pacific/Efate', 'VUT-11' },
{ 'Pacific/Enderbury', 'PHOT-13' },
{ 'Pacific/Fakaofo', 'TKT-13' },
@@ -416,7 +424,7 @@ TZ = {
{ 'Pacific/Saipan', 'ChST-10' },
{ 'Pacific/Tahiti', 'TAHT10' },
{ 'Pacific/Tarawa', 'GILT-12' },
- { 'Pacific/Tongatapu', 'TOT-13' },
+ { 'Pacific/Tongatapu', '<+13>-13<+14>,M11.1.0,M1.3.0/3' },
{ 'Pacific/Wake', 'WAKT-12' },
{ 'Pacific/Wallis', 'WFT-12' },
}
diff --git a/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua b/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua
index 351ebccd3..e5da7c644 100644
--- a/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua
+++ b/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua
@@ -27,7 +27,7 @@ OFFSET = {
cot = -18000, -- COT
mst = -25200, -- MST
mdt = -21600, -- MDT
- vet = -16200, -- VET
+ vet = -14400, -- VET
gft = -10800, -- GFT
pst = -28800, -- PST
pdt = -25200, -- PDT
@@ -43,65 +43,37 @@ OFFSET = {
uyt = -10800, -- UYT
fnt = -7200, -- FNT
srt = -10800, -- SRT
- clt = -10800, -- CLT
+ clt = -14400, -- CLT
+ clst = -10800, -- CLST
egt = -3600, -- EGT
egst = 0, -- EGST
nst = -12600, -- NST
ndt = -9000, -- NDT
- awst = 28800, -- AWST
- davt = 25200, -- DAVT
- ddut = 36000, -- DDUT
mist = 39600, -- MIST
- mawt = 18000, -- MAWT
nzst = 43200, -- NZST
nzdt = 46800, -- NZDT
- rott = -10800, -- ROTT
- syot = 10800, -- SYOT
- utc = 0, -- UTC
- vost = 21600, -- VOST
- almt = 21600, -- ALMT
- anat = 43200, -- ANAT
- aqtt = 18000, -- AQTT
- tmt = 18000, -- TMT
- azt = 14400, -- AZT
- azst = 18000, -- AZST
ict = 25200, -- ICT
- kgt = 21600, -- KGT
bnt = 28800, -- BNT
- yakt = 32400, -- YAKT
chot = 28800, -- CHOT
chost = 32400, -- CHOST
- ist = 19800, -- IST
bdt = 21600, -- BDT
tlt = 32400, -- TLT
gst = 14400, -- GST
- tjt = 18000, -- TJT
hkt = 28800, -- HKT
hovt = 25200, -- HOVT
hovst = 28800, -- HOVST
- irkt = 28800, -- IRKT
wib = 25200, -- WIB
wit = 32400, -- WIT
+ ist = 7200, -- IST
+ idt = 10800, -- IDT
aft = 16200, -- AFT
- pett = 43200, -- PETT
pkt = 18000, -- PKT
npt = 20700, -- NPT
- krat = 25200, -- KRAT
myt = 28800, -- MYT
- magt = 36000, -- MAGT
wita = 28800, -- WITA
pht = 28800, -- PHT
- novt = 21600, -- NOVT
- omst = 21600, -- OMST
- orat = 18000, -- ORAT
kst = 30600, -- KST
- qyzt = 21600, -- QYZT
- mmt = 23400, -- MMT
- sakt = 36000, -- SAKT
- uzt = 18000, -- UZT
sgt = 28800, -- SGT
- sret = 39600, -- SRET
- get = 14400, -- GET
irst = 12600, -- IRST
irdt = 16200, -- IRDT
btt = 21600, -- BTT
@@ -109,8 +81,7 @@ OFFSET = {
ulat = 28800, -- ULAT
ulast = 32400, -- ULAST
xjt = 21600, -- XJT
- vlat = 36000, -- VLAT
- yekt = 18000, -- YEKT
+ mmt = 23400, -- MMT
azot = -3600, -- AZOT
azost = 0, -- AZOST
cvt = -3600, -- CVT
@@ -121,12 +92,11 @@ OFFSET = {
acwst = 31500, -- ACWST
lhst = 37800, -- LHST
lhdt = 39600, -- LHDT
+ awst = 28800, -- AWST
msk = 10800, -- MSK
- samt = 14400, -- SAMT
iot = 21600, -- IOT
cxt = 25200, -- CXT
cct = 23400, -- CCT
- tft = 18000, -- TFT
sct = 14400, -- SCT
mvt = 18000, -- MVT
mut = 14400, -- MUT
@@ -137,7 +107,8 @@ OFFSET = {
chast = 45900, -- CHAST
chadt = 49500, -- CHADT
chut = 36000, -- CHUT
- east = -18000, -- EAST
+ east = -21600, -- EAST
+ easst = -18000, -- EASST
vut = 39600, -- VUT
phot = 46800, -- PHOT
tkt = 46800, -- TKT
@@ -162,7 +133,6 @@ OFFSET = {
ckt = -36000, -- CKT
taht = -36000, -- TAHT
gilt = 43200, -- GILT
- tot = 46800, -- TOT
wakt = 43200, -- WAKT
wft = 43200, -- WFT
}
diff --git a/modules/luci-base/luasrc/tools/status.lua b/modules/luci-base/luasrc/tools/status.lua
index ac053eac8..4da0cf984 100644
--- a/modules/luci-base/luasrc/tools/status.lua
+++ b/modules/luci-base/luasrc/tools/status.lua
@@ -48,24 +48,33 @@ local function dhcp_leases_common(family)
fd:close()
end
- local fd = io.open("/tmp/hosts/odhcpd", "r")
+ local lease6file = "/tmp/hosts/odhcpd"
+ uci:foreach("dhcp", "odhcpd",
+ function(t)
+ if t.leasefile and nfs.access(t.leasefile) then
+ lease6file = t.leasefile
+ return false
+ end
+ end)
+ local fd = io.open(lease6file, "r")
if fd then
while true do
local ln = fd:read("*l")
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/util.lua b/modules/luci-base/luasrc/util.lua
index 5bf0beb6c..0e7334be8 100644
--- a/modules/luci-base/luasrc/util.lua
+++ b/modules/luci-base/luasrc/util.lua
@@ -16,7 +16,7 @@ local _ubus_connection = nil
local getmetatable, setmetatable = getmetatable, setmetatable
local rawget, rawset, unpack = rawget, rawset, unpack
-local tostring, type, assert = tostring, type, assert
+local tostring, type, assert, error = tostring, type, assert, error
local ipairs, pairs, next, loadstring = ipairs, pairs, next, loadstring
local require, pcall, xpcall = require, pcall, xpcall
local collectgarbage, get_memory_limit = collectgarbage, get_memory_limit
@@ -27,14 +27,27 @@ module "luci.util"
-- Pythonic string formatting extension
--
getmetatable("").__mod = function(a, b)
+ local ok, res
+
if not b then
return a
elseif type(b) == "table" then
+ local k, _
for k, _ in pairs(b) do if type(b[k]) == "userdata" then b[k] = tostring(b[k]) end end
- return a:format(unpack(b))
+
+ ok, res = pcall(a.format, a, unpack(b))
+ if not ok then
+ error(res, 2)
+ end
+ return res
else
if type(b) == "userdata" then b = tostring(b) end
- return a:format(b)
+
+ ok, res = pcall(a.format, a, b)
+ if not ok then
+ error(res, 2)
+ end
+ return res
end
end
@@ -157,7 +170,7 @@ end
-- command line parameter).
function shellsqescape(value)
local res
- res, _ = string.gsub(res, "'", "'\\''")
+ res, _ = string.gsub(value, "'", "'\\''")
return res
end
@@ -636,6 +649,23 @@ function libpath()
return require "nixio.fs".dirname(ldebug.__file__)
end
+function checklib(fullpathexe, wantedlib)
+ local fs = require "nixio.fs"
+ local haveldd = fs.access('/usr/bin/ldd')
+ if not haveldd then
+ return false
+ end
+ local libs = exec("/usr/bin/ldd " .. fullpathexe)
+ if not libs then
+ return false
+ end
+ for k, v in ipairs(split(libs)) do
+ if v:find(wantedlib) then
+ return true
+ end
+ end
+ return false
+end
--
-- Coroutine safe xpcall and pcall versions modified for Luci
diff --git a/modules/luci-base/luasrc/view/sysauth.htm b/modules/luci-base/luasrc/view/sysauth.htm
index e20750491..f6b0f5706 100644
--- a/modules/luci-base/luasrc/view/sysauth.htm
+++ b/modules/luci-base/luasrc/view/sysauth.htm
@@ -7,14 +7,14 @@
<%+header%>
<form method="post" action="<%=pcdata(luci.http.getenv("REQUEST_URI"))%>">
+ <%- if fuser then %>
+ <div class="errorbox"><%:Invalid username and/or password! Please try again.%></div>
+ <% end -%>
+
<div class="cbi-map">
<h2 name="content"><%:Authorization Required%></h2>
<div class="cbi-map-descr">
<%:Please enter your username and password.%>
- <%- if fuser then %>
- <div class="error"><%:Invalid username and/or password! Please try again.%></div>
- <br />
- <% end -%>
</div>
<fieldset class="cbi-section"><fieldset class="cbi-section-node">
<div class="cbi-value">