diff options
12 files changed, 377 insertions, 86 deletions
diff --git a/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua b/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua index 3f26aeed6f..36c5554d35 100644 --- a/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua +++ b/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua @@ -25,6 +25,7 @@ function index() conntrack = _("Conntrack"), cpu = _("Processor"), + cpufreq = _("CPU Frequency"), csv = _("CSV Output"), df = _("Disk Space Usage"), disk = _("Disk Usage"), @@ -49,6 +50,7 @@ function index() sensors = _("Sensors"), splash_leases = _("Splash Leases"), tcpconns = _("TCP Connections"), + thermal = _("Thermal"), unixsock = _("UnixSock"), uptime = _("Uptime") } @@ -56,8 +58,12 @@ function index() -- our collectd menu local collectd_menu = { output = { "csv", "network", "rrdtool", "unixsock" }, - general = { "cpu", "df", "disk", "email", "entropy", "exec", "irq", "load", "memory", "nut", "processes", "sensors", "uptime" }, - network = { "conntrack", "dns", "interface", "iptables", "netlink", "olsrd", "openvpn", "ping", "splash_leases", "tcpconns", "iwinfo" } + general = { "cpu", "cpufreq", "df", "disk", "email", + "entropy", "exec", "irq", "load", "memory", + "nut", "processes", "sensors", "thermal", "uptime" }, + network = { "conntrack", "dns", "interface", "iptables", + "netlink", "olsrd", "openvpn", "ping", + "splash_leases", "tcpconns", "iwinfo" } } -- create toplevel menu nodes diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/cpufreq.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/cpufreq.lua new file mode 100644 index 0000000000..d1116630b4 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/cpufreq.lua @@ -0,0 +1,14 @@ +-- Licensed to the public under the Apache License 2.0. + +m = Map("luci_statistics", + translate("CPU Frequency Plugin Configuration"), + translate("This plugin collects statistics about the processor frequency scaling.")) + +-- collectd_cpufreq config section +s = m:section( NamedSection, "collectd_cpufreq", "luci_statistics" ) + +-- collectd_cpufreq.enable +enable = s:option( Flag, "enable", translate("Enable this plugin") ) +enable.default = 0 + +return m diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/thermal.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/thermal.lua new file mode 100644 index 0000000000..bdf41b79bc --- /dev/null +++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/thermal.lua @@ -0,0 +1,29 @@ +-- Licensed to the public under the Apache License 2.0. + +m = Map("luci_statistics", + translate("Thermal Plugin Configuration"), + translate("The thermal plugin will monitor temperature of the system. " .. + "Data is typically read from /sys/class/thermal/*/temp " .. + "( '*' denotes the thermal device to be read, e.g. thermal_zone1 )") + ) + +-- collectd_thermal config section +s = m:section( NamedSection, "collectd_thermal", "luci_statistics" ) + +-- collectd_thermal.enable +enable = s:option( Flag, "enable", translate("Enable this plugin") ) +enable.default = 0 + +-- collectd_thermal.tz (Device) +tz = s:option( Value, "Device", translate("Monitor device(s) / thermal zone(s)"), + translate("Empty value = monitor all") ) +tz.optional = true +tz:depends( "enable", 1 ) + +-- collectd_thermal.ignoreselected (IgnoreSelected) +ignoreselected = s:option( Flag, "IgnoreSelected", translate("Monitor all except specified") ) +ignoreselected.default = 0 +ignoreselected.optional = true +ignoreselected:depends( "enable", 1 ) + +return m diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua new file mode 100644 index 0000000000..25a72d2285 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua @@ -0,0 +1,25 @@ +-- Licensed to the public under the Apache License 2.0. + +module("luci.statistics.rrdtool.definitions.cpufreq",package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + + return { + title = "%H: Processor frequency", + alt_autoscale = true, + vlabel = "Frequency (Hz)", + number_format = "%3.2lf%s", + data = { + sources = { + cpufreq = { "" } + }, + options = { + cpufreq_0 = { color = "ff0000", title = "Core 0", noarea=true, overlay=true }, + cpufreq_1 = { color = "0000ff", title = "Core 1", noarea=true, overlay=true }, + cpufreq_2 = { color = "00ff00", title = "Core 2", noarea=true, overlay=true }, + cpufreq_3 = { color = "00ffff", title = "Core 3", noarea=true, overlay=true } + } + } + } +end + diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/thermal.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/thermal.lua new file mode 100644 index 0000000000..532246465e --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/thermal.lua @@ -0,0 +1,20 @@ +-- Licensed to the public under the Apache License 2.0. + +module("luci.statistics.rrdtool.definitions.thermal",package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + + return { + title = "%H: Temperature of %pi", + alt_autoscale = true, + vlabel = "Celsius", + number_format = "%3.1lf%s", + data = { + types = { "temperature" }, + options = { + temperature = { color = "ff0000", title = "Temperature", noarea=true }, + } + } + } +end + diff --git a/applications/luci-app-statistics/root/etc/config/luci_statistics b/applications/luci-app-statistics/root/etc/config/luci_statistics index 4435d5c61e..774a8382e2 100644 --- a/applications/luci-app-statistics/root/etc/config/luci_statistics +++ b/applications/luci-app-statistics/root/etc/config/luci_statistics @@ -55,6 +55,9 @@ config statistics 'collectd_conntrack' config statistics 'collectd_cpu' option enable '1' +config statistics 'collectd_cpufreq' + option enable '0' + config statistics 'collectd_df' option enable '0' option Devices '/dev/mtdblock/4' @@ -151,6 +154,11 @@ config statistics 'collectd_tcpconns' option ListeningPorts '0' option LocalPorts '22 80' +config statistics 'collectd_thermal' + option enable '0' + option IgnoreSelected '0' + option Device '' + config statistics 'collectd_uptime' option enable '0' diff --git a/applications/luci-app-statistics/root/usr/bin/stat-genconfig b/applications/luci-app-statistics/root/usr/bin/stat-genconfig index 49d8a09935..df9af15261 100755 --- a/applications/luci-app-statistics/root/usr/bin/stat-genconfig +++ b/applications/luci-app-statistics/root/usr/bin/stat-genconfig @@ -273,6 +273,12 @@ plugins = { { } }, + cpufreq = { + { }, + { }, + { } + }, + csv = { { "DataDir" }, { "StoreRates" }, @@ -417,6 +423,12 @@ plugins = { { "LocalPorts", "RemotePorts" } }, + thermal = { + { }, + { "IgnoreSelected" }, + { "Device" } + }, + unixsock = { { "SocketFile", "SocketGroup", "SocketPerms" }, { }, diff --git a/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua b/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua index c9a507eaa2..66136903a7 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,99 @@ 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/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 +334,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 +346,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,7 +355,7 @@ 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/Simferopol', 'MSK-3' }, @@ -367,7 +370,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 +380,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 +422,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/protocols/luci-proto-wireguard/Makefile b/protocols/luci-proto-wireguard/Makefile new file mode 100644 index 0000000000..ed94a557b6 --- /dev/null +++ b/protocols/luci-proto-wireguard/Makefile @@ -0,0 +1,16 @@ +# +# Copyright (C) 2016 Dan Luedtke <mail@danrl.com> +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=Support for WireGuard VPN +LUCI_DEPENDS:=+kmod-wireguard +wireguard-tools + +PKG_MAINTAINER:=Dan Luedtke <mail@danrl.com> + +include ../../luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/protocols/luci-proto-wireguard/luasrc/model/cbi/admin_network/proto_wireguard.lua b/protocols/luci-proto-wireguard/luasrc/model/cbi/admin_network/proto_wireguard.lua new file mode 100644 index 0000000000..4cda94c7d0 --- /dev/null +++ b/protocols/luci-proto-wireguard/luasrc/model/cbi/admin_network/proto_wireguard.lua @@ -0,0 +1,147 @@ +-- Copyright 2016 Dan Luedtke <mail@danrl.com> +-- Licensed to the public under the Apache License 2.0. + + +local map, section, net = ... +local ifname = net:get_interface():name() +local private_key, listen_port +local metric, mtu, preshared_key +local peers, public_key, allowed_ips, endpoint, persistent_keepalive + + +-- general --------------------------------------------------------------------- + +private_key = section:taboption( + "general", + Value, + "private_key", + translate("Private Key"), + translate("Required. Base64-encoded private key for this interface.") +) +private_key.password = true +private_key.datatype = "rangelength(44, 44)" +private_key.optional = false + + +listen_port = section:taboption( + "general", + Value, + "listen_port", + translate("Listen Port"), + translate("Optional. UDP port used for outgoing and incoming packets.") +) +listen_port.datatype = "port" +listen_port.placeholder = "51820" +listen_port.optional = true + + +-- advanced -------------------------------------------------------------------- + +metric = section:taboption( + "advanced", + Value, + "metric", + translate("Metric"), + translate("Optional.") +) +metric.datatype = "uinteger" +metric.placeholder = "0" +metric.optional = true + + +mtu = section:taboption( + "advanced", + Value, + "mtu", + translate("MTU"), + translate("Optional. Maximum Transmission Unit of tunnel interface.") +) +mtu.datatype = "range(1280,1423)" +mtu.placeholder = "1423" +mtu.optional = true + + +preshared_key = section:taboption( + "advanced", + Value, + "preshared_key", + translate("Preshared Key"), + translate("Optional. Adds in an additional layer of symmetric-key " .. + "cryptography for post-quantum resistance.") +) +preshared_key.password = true +preshared_key.datatype = "rangelength(44, 44)" +preshared_key.optional = true + + +-- peers ----------------------------------------------------------------------- + +peers = map:section( + TypedSection, + "wireguard_" .. ifname, + translate("Peers"), + translate("Further information about WireGuard interfaces and peers " .. + "at <a href=\"http://wireguard.io\">wireguard.io</a>.") +) +peers.template = "cbi/tsection" +peers.anonymous = true +peers.addremove = true + + +public_key = peers:option( + Value, + "public_key", + translate("Public Key"), + translate("Required. Public key of peer.") +) +public_key.datatype = "rangelength(44, 44)" +public_key.optional = false + + +allowed_ips = peers:option( + DynamicList, + "allowed_ips", + translate("Allowed IPs"), + translate("Required. IP addresses and prefixes that this peer is allowed " .. + "to use inside the tunnel. Routes will be added accordingly.") +) +allowed_ips.datatype = "ipaddr" +allowed_ips.optional = false + + +route_allowed_ips = peers:option( + Flag, + "route_allowed_ips", + translate("Route Allowed IPs"), + translate("Optional. Create routes for Allowed IPs for this peer.") +) + + +endpoint_host = peers:option( + Value, + "endpoint_host", + translate("Endpoint Host"), + translate("Optional. Host of peer. Names are resolved " .. + "prior to bringing up the interface.")) +endpoint_host.placeholder = "vpn.example.com" +endpoint_host.datatype = "host" + + +endpoint_port = peers:option( + Value, + "endpoint_port", + translate("Endpoint Port"), + translate("Optional. Port of peer.")) +endpoint_port.placeholder = "51820" +endpoint_port.datatype = "port" + + +persistent_keepalive = peers:option( + Value, + "persistent_keepalive", + translate("Persistent Keep Alive"), + translate("Optional. Seconds between keep alive messages. " .. + "Default is 0 (disabled). Recommended value if " .. + "this device is behind a NAT is 25.")) +persistent_keepalive.datatype = "range(0, 65535)" +persistent_keepalive.placeholder = "0" diff --git a/protocols/luci-proto-wireguard/luasrc/model/network/proto_wireguard.lua b/protocols/luci-proto-wireguard/luasrc/model/network/proto_wireguard.lua new file mode 100644 index 0000000000..d6937618a7 --- /dev/null +++ b/protocols/luci-proto-wireguard/luasrc/model/network/proto_wireguard.lua @@ -0,0 +1,42 @@ +-- Copyright 2016 Dan Luedtke <mail@danrl.com> +-- Licensed to the public under the Apache License 2.0. + +local netmod = luci.model.network +local interface = luci.model.network.interface +local proto = netmod:register_protocol("wireguard") + +function proto.get_i18n(self) + return luci.i18n.translate("WireGuard VPN") +end + +function proto.ifname(self) + return self.sid +end + +function proto.get_interface(self) + return interface(self:ifname(), self) +end + +function proto.opkg_package(self) + return "wireguard-tools" +end + +function proto.is_installed(self) + return nixio.fs.access("/lib/netifd/proto/wireguard.sh") +end + +function proto.is_floating(self) + return true +end + +function proto.is_virtual(self) + return true +end + +function proto.get_interfaces(self) + return nil +end + +function proto.contains_interface(self, ifc) + return (netmod:ifnameof(ifc) == self:ifname()) +end |