diff options
Diffstat (limited to 'modules/luci-base/luasrc')
-rw-r--r-- | modules/luci-base/luasrc/cbi/datatypes.lua | 80 | ||||
-rw-r--r-- | modules/luci-base/luasrc/model/network.lua | 7 | ||||
-rw-r--r-- | modules/luci-base/luasrc/sys/iptparser.lua | 36 | ||||
-rw-r--r-- | modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua | 101 | ||||
-rw-r--r-- | modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua | 41 | ||||
-rw-r--r-- | modules/luci-base/luasrc/tools/status.lua | 12 | ||||
-rw-r--r-- | modules/luci-base/luasrc/tools/webadmin.lua | 2 | ||||
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm | 4 | ||||
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/fvalue.htm | 1 | ||||
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/lvalue.htm | 3 | ||||
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/mvalue.htm | 5 | ||||
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/network_ifacelist.htm | 12 | ||||
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/network_netlist.htm | 3 |
13 files changed, 178 insertions, 129 deletions
diff --git a/modules/luci-base/luasrc/cbi/datatypes.lua b/modules/luci-base/luasrc/cbi/datatypes.lua index 626ad91c75..72b41ddad8 100644 --- a/modules/luci-base/luasrc/cbi/datatypes.lua +++ b/modules/luci-base/luasrc/cbi/datatypes.lua @@ -131,6 +131,40 @@ function ip6prefix(val) return ( val and val >= 0 and val <= 128 ) end +function ipmask(val) + return ipmask4(val) or ipmask6(val) +end + +function ipmask4(val) + local ip, mask = val:match("^([^/]+)/([^/]+)$") + local bits = tonumber(mask) + + if bits and (bits < 0 or bits > 32) then + return false + end + + if not bits and mask and not ip4addr(mask) then + return false + end + + return ip4addr(ip or val) +end + +function ipmask6(val) + local ip, mask = val:match("^([^/]+)/([^/]+)$") + local bits = tonumber(mask) + + if bits and (bits < 0 or bits > 128) then + return false + end + + if not bits and mask and not ip6addr(mask) then + return false + end + + return ip6addr(ip or val) +end + function port(val) val = tonumber(val) return ( val and val >= 0 and val <= 65535 ) @@ -378,29 +412,29 @@ function dateyyyymmdd(val) return false; end - local days_in_month = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } - - local function is_leap_year(year) - return (year % 4 == 0) and ((year % 100 ~= 0) or (year % 400 == 0)) - end - - function get_days_in_month(month, year) - if (month == 2) and is_leap_year(year) then - return 29 - else - return days_in_month[month] - end - end - if (year < 2015) then - return false - end - if ((month == 0) or (month > 12)) then - return false - end - if ((day == 0) or (day > get_days_in_month(month, year))) then - return false - end - return true + local days_in_month = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } + + local function is_leap_year(year) + return (year % 4 == 0) and ((year % 100 ~= 0) or (year % 400 == 0)) + end + + function get_days_in_month(month, year) + if (month == 2) and is_leap_year(year) then + return 29 + else + return days_in_month[month] + end + end + if (year < 2015) then + return false + end + if ((month == 0) or (month > 12)) then + return false + end + if ((day == 0) or (day > get_days_in_month(month, year))) then + return false + end + return true end return false end diff --git a/modules/luci-base/luasrc/model/network.lua b/modules/luci-base/luasrc/model/network.lua index 2d8336bf33..49d91b875a 100644 --- a/modules/luci-base/luasrc/model/network.lua +++ b/modules/luci-base/luasrc/model/network.lua @@ -950,6 +950,13 @@ function protocol.dns6addrs(self) return dns end +function protocol.ip6prefix(self) + local prefix = self:_ubus("ipv6-prefix") + if prefix and #prefix > 0 then + return "%s/%d" %{ prefix[1].address, prefix[1].mask } + end +end + function protocol.is_bridge(self) return (not self:is_virtual() and self:type() == "bridge") end 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 c9a507eaa2..465d7df3d3 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' }, @@ -201,97 +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', 'CLT4CLST,M8.2.6/24,M5.2.6/24' }, - { 'Antarctica/Rothera', 'ROTT3' }, - { 'Antarctica/Syowa', 'SYOT-3' }, - { 'Antarctica/Troll', 'UTC0CEST-2,M3.5.0/1,M10.5.0/3' }, - { 'Antarctica/Vostok', 'VOST-6' }, + { '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-4' }, + { '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.6/1,M10.3.6/144' }, - { 'Asia/Hebron', 'EET-2EEST,M3.5.6/1,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-11' }, - { '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' }, @@ -332,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' }, @@ -343,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' }, @@ -352,9 +356,10 @@ 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' }, @@ -367,7 +372,7 @@ TZ = { { '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' }, @@ -377,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' }, @@ -419,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 a8417e06c8..e5da7c6442 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 @@ -49,59 +49,31 @@ OFFSET = { 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 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 = 39600, -- 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 @@ -163,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 a1ecbe71d0..b531393d0f 100644 --- a/modules/luci-base/luasrc/tools/status.lua +++ b/modules/luci-base/luasrc/tools/status.lua @@ -26,17 +26,18 @@ local function dhcp_leases_common(family) break else local ts, mac, ip, name, duid = ln:match("^(%d+) (%S+) (%S+) (%S+) (%S+)") + local expire = tonumber(ts) or 0 if ts and mac and ip and name and duid then if family == 4 and not ip:match(":") then rv[#rv+1] = { - expires = os.difftime(tonumber(ts) or 0, os.time()), + expires = (expire ~= 0) and os.difftime(expire, os.time()), macaddr = mac, ipaddr = ip, hostname = (name ~= "*") and name } elseif family == 6 and ip:match(":") then rv[#rv+1] = { - expires = os.difftime(tonumber(ts) or 0, os.time()), + expires = (expire ~= 0) and os.difftime(expire, os.time()), ip6addr = ip, duid = (duid ~= "*") and duid, hostname = (name ~= "*") and name @@ -63,17 +64,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")%> />   + <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")%> />   + <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")%> />   + <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")%> />   + <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:%> </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..db17450d27 100644 --- a/modules/luci-base/luasrc/view/cbi/mvalue.htm +++ b/modules/luci-base/luasrc/view/cbi/mvalue.htm @@ -24,18 +24,19 @@ <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 %> + <% if self.size and (i % self.size) == 0 then write('<br />') end %> <% end %> </div> <% 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") - %> />   + %> /> + <%- if not self.widget or self.widget == "checkbox" or self.widget == "radio" then -%> + <label<%=attr("for", cbid .. "." .. iface:name())%>></label> + <%- end -%> +   <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", " ") - %> />   + %> /> + <%- if not self.widget or self.widget == "checkbox" or self.widget == "radio" then -%> + <label<%=attr("for", cbid .. "_custom")%>></label> + <%- end -%> +   <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")%> />   + <%- 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 -%> |