summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-mwan3
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-mwan3')
-rw-r--r--applications/luci-app-mwan3/luasrc/controller/mwan3.lua2
-rw-r--r--applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_hotplugscript.lua51
-rw-r--r--applications/luci-app-mwan3/luasrc/model/cbi/mwan/globalsconfig.lua40
-rw-r--r--applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua10
-rw-r--r--applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua16
-rw-r--r--applications/luci-app-mwan3/po/ja/mwan3.po69
-rw-r--r--applications/luci-app-mwan3/po/templates/mwan3.pot32
-rw-r--r--applications/luci-app-mwan3/po/zh-cn/mwan3.po29
-rwxr-xr-xapplications/luci-app-mwan3/root/etc/uci-defaults/60_luci-mwan37
9 files changed, 203 insertions, 53 deletions
diff --git a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua
index ca39c9bf30..c24beda281 100644
--- a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua
+++ b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua
@@ -29,6 +29,8 @@ function index()
entry({"admin", "network", "mwan", "configuration"},
alias("admin", "network", "mwan", "configuration", "interface"),
_("Configuration"), 20)
+ entry({"admin", "network", "mwan", "configuration", "globals"},
+ cbi("mwan/globalsconfig"),_("Globals"), 5).leaf = true
entry({"admin", "network", "mwan", "configuration", "interface"},
arcombine(cbi("mwan/interface"), cbi("mwan/interfaceconfig")),
_("Interfaces"), 10).leaf = true
diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_hotplugscript.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_hotplugscript.lua
index 0e7b8b11d0..1b97080216 100644
--- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_hotplugscript.lua
+++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_hotplugscript.lua
@@ -1,55 +1,40 @@
-- ------ hotplug script configuration ------ --
fs = require "nixio.fs"
-sys = require "luci.sys"
ut = require "luci.util"
-script = "/etc/hotplug.d/iface/16-mwancustom"
-scriptBackup = "/etc/hotplug.d/iface/16-mwancustombak"
-
-if luci.http.formvalue("cbid.luci.1._restorebak") then -- restore button has been clicked
- luci.http.redirect(luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript") .. "?restore=yes")
-elseif luci.http.formvalue("restore") == "yes" then -- restore script from backup
- os.execute("cp -f " .. scriptBackup .. " " .. script)
-end
-
+script = "/etc/mwan3.user"
m5 = SimpleForm("luci", nil)
m5:append(Template("mwan/advanced_hotplugscript")) -- highlight current tab
f = m5:section(SimpleSection, nil,
- translate("This section allows you to modify the contents of /etc/hotplug.d/iface/16-mwancustom<br />" ..
- "This is useful for running system commands and/or scripts based on interface ifup or ifdown hotplug events<br /><br />" ..
+ translate("This section allows you to modify the content of \"/etc/mwan3.user\".<br />" ..
+ "The file is also preserved during sysupgrade.<br />" ..
+ "<br />" ..
"Notes:<br />" ..
- "The first line of the script must be &#34;#!/bin/sh&#34; without quotes<br />" ..
- "Lines beginning with # are comments and are not executed<br /><br />" ..
- "Available variables:<br />" ..
- "$ACTION is the hotplug event (ifup, ifdown)<br />" ..
- "$INTERFACE is the interface name (wan1, wan2, etc.)<br />" ..
- "$DEVICE is the device name attached to the interface (eth0.1, eth1, etc.)"))
-
-
-restore = f:option(Button, "_restorebak", translate("Restore default hotplug script"))
- restore.inputtitle = translate("Restore...")
- restore.inputstyle = "apply"
+ "This file is interpreted as a shell script.<br />" ..
+ "The first line of the script must be &#34;#!/bin/sh&#34; without quotes.<br />" ..
+ "Lines beginning with # are comments and are not executed.<br />" ..
+ "Put your custom mwan3 action here, they will<br />" ..
+ "be executed with each netifd hotplug interface event<br />" ..
+ "on interfaces for which mwan3 is enabled.<br />" ..
+ "<br />" ..
+ "There are three main environment variables that are passed to this script.<br />" ..
+ "<br />" ..
+ "$ACTION Either \"ifup\" or \"ifdown\"<br />" ..
+ "$INTERFACE Name of the interface which went up or down (e.g. \"wan\" or \"wwan\")<br />" ..
+ "$DEVICE Physical device name which interface went up or down (e.g. \"eth0\" or \"wwan0\")<br />" ..
+ "<br />"))
t = f:option(TextValue, "lines")
t.rmempty = true
t.rows = 20
-
function t.cfgvalue()
- local hps = fs.readfile(script)
- if not hps or hps == "" then -- if script does not exist or is blank restore from backup
- sys.call("cp -f " .. scriptBackup .. " " .. script)
- return fs.readfile(script)
- else
- return hps
- end
+ return fs.readfile(script)
end
-
function t.write(self, section, data) -- format and write new data to script
return fs.writefile(script, ut.trim(data:gsub("\r\n", "\n")) .. "\n")
end
-
return m5
diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/globalsconfig.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/globalsconfig.lua
new file mode 100644
index 0000000000..919ed46cd4
--- /dev/null
+++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/globalsconfig.lua
@@ -0,0 +1,40 @@
+--[[
+LuCI - Lua Configuration Interface
+
+Copyright 2017 Florian Eckert <fe@dev.tdt.de>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+]]--
+
+local net = require "luci.model.network".init()
+
+m = Map("mwan3")
+
+s = m:section(NamedSection, "globals", "globals", translate("Globals mwan3 options"))
+n = s:option(ListValue, "local_source",
+ translate("Local source interface"),
+ translate("Use the IP address of this interface as source IP address for traffic initiated by the router itself"))
+n:value("none")
+n.default = "none"
+for _, net in ipairs(net:get_networks()) do
+ if net:name() ~= "loopback" then
+ n:value(net:name())
+ end
+end
+n.rmempty = false
+
+mask = s:option(
+ Value,
+ "mmx_mask",
+ translate("Firewall mask"),
+ translate("Enter value in hex, starting with <code>0x</code>"))
+mask.datatype = "hex(4)"
+mask.default = "0xff00"
+
+return m
diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua
index aeabc63616..c8c122ad48 100644
--- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua
+++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua
@@ -147,6 +147,16 @@ track_ip = mwan_interface:option(DummyValue, "track_ip", translate("Tracking IP"
end
end
+track_method = mwan_interface:option(DummyValue, "track_method", translate("Tracking method"))
+ track_method.rawhtml = true
+ function track_method.cfgvalue(self, s)
+ if tracked then
+ return self.map:get(s, "track_method") or "&#8212;"
+ else
+ return "&#8212;"
+ end
+ end
+
reliability = mwan_interface:option(DummyValue, "reliability", translate("Tracking reliability"))
reliability.rawhtml = true
function reliability.cfgvalue(self, s)
diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua
index 2b46376399..0318091d6c 100644
--- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua
+++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua
@@ -102,6 +102,12 @@ enabled = mwan_interface:option(ListValue, "enabled", translate("Enabled"))
enabled:value("1", translate("Yes"))
enabled:value("0", translate("No"))
+initial_state = mwan_interface:option(ListValue, "initial_state", translate("Initial state"),
+ translate("Expect interface state on up event"))
+ initial_state.default = "online"
+ initial_state:value("online", translate("Online"))
+ initial_state:value("offline", translate("Offline"))
+
family = mwan_interface:option(ListValue, "family", translate("Internet Protocol"))
family.default = "ipv4"
family:value("ipv4", translate("IPv4"))
@@ -111,6 +117,12 @@ track_ip = mwan_interface:option(DynamicList, "track_ip", translate("Tracking ho
translate("This hostname or IP address will be pinged to determine if the link is up or down. Leave blank to assume interface is always online"))
track_ip.datatype = "host"
+track_method = mwan_interface:option(ListValue, "track_method", translate("Tracking method"))
+ track_method.default = "ping"
+ track_method:value("ping")
+ track_method:value("arping")
+ track_method:value("httping")
+
reliability = mwan_interface:option(Value, "reliability", translate("Tracking reliability"),
translate("Acceptable values: 1-100. This many Tracking IP addresses must respond for the link to be deemed up"))
reliability.datatype = "range(1, 100)"
@@ -183,6 +195,10 @@ failure = mwan_interface:option(Value, "failure_interval", translate("Failure in
failure:value("1800", translatef("%d minutes", 30))
failure:value("3600", translatef("%d hour", 1))
+keep_failure = mwan_interface:option(Flag, "keep_failure_interval", translate("Keep failure interval"),
+ translate("Keep ping failure interval during failure state"))
+ keep_failure.default = keep_failure.disabled
+
recovery = mwan_interface:option(Value, "recovery_interval", translate("Recovery interval"),
translate("Ping interval during failure recovering"))
recovery.default = "5"
diff --git a/applications/luci-app-mwan3/po/ja/mwan3.po b/applications/luci-app-mwan3/po/ja/mwan3.po
index 925912e3ce..89fa5ea02d 100644
--- a/applications/luci-app-mwan3/po/ja/mwan3.po
+++ b/applications/luci-app-mwan3/po/ja/mwan3.po
@@ -7,7 +7,7 @@ msgstr ""
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: Poedit 2.0.2\n"
+"X-Generator: Poedit 2.0.3\n"
"Last-Translator: INAGAKI Hiroshi <musashino.open@gmail.com>\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"Language: ja\n"
@@ -47,7 +47,7 @@ msgid "Check routing table"
msgstr "ルーティング テーブルのチェック"
msgid "Collecting data..."
-msgstr ""
+msgstr "データ収集中です..."
msgid "Configuration"
msgstr "設定"
@@ -77,7 +77,7 @@ msgid "Diagnostics"
msgstr "診断機能"
msgid "Disabled"
-msgstr ""
+msgstr "無効"
msgid ""
"Downed interface will be deemed up after this many successful ping tests"
@@ -89,11 +89,14 @@ msgid "Enabled"
msgstr "有効"
msgid "Error collecting troubleshooting information"
-msgstr ""
+msgstr "トラブルシューティング情報の収集エラー"
msgid "Errors"
msgstr "エラー"
+msgid "Expect interface state on up event"
+msgstr ""
+
msgid "Failure interval"
msgstr "障害検出 インターバル"
@@ -103,6 +106,12 @@ msgstr ""
msgid "Flush global firewall conntrack table on interface events"
msgstr ""
+msgid "Globals"
+msgstr ""
+
+msgid "Globals mwan3 options"
+msgstr ""
+
msgid "Hotplug Script"
msgstr "ホットプラグ スクリプト"
@@ -121,6 +130,9 @@ msgstr "IPv4"
msgid "IPv6"
msgstr "IPv6"
+msgid "Initial state"
+msgstr ""
+
msgid "Interface"
msgstr "インターフェース"
@@ -144,9 +156,15 @@ msgstr "インターフェース"
msgid "Internet Protocol"
msgstr "インターネット プロトコル"
-msgid "Last 50 MWAN systemlog entries. Newest entries sorted at the top :"
+msgid "Keep failure interval"
msgstr ""
+msgid "Keep ping failure interval during failure state"
+msgstr ""
+
+msgid "Last 50 MWAN systemlog entries. Newest entries sorted at the top :"
+msgstr "直近の MWAN システムログ(50行)です。一番上が最新の行です:"
+
msgid "Last resort"
msgstr "最終手段"
@@ -156,6 +174,9 @@ msgstr "負荷分散"
msgid "Loading"
msgstr "読込中"
+msgid "Local source interface"
+msgstr ""
+
msgid "MWAN Config"
msgstr "MWAN 設定"
@@ -222,7 +243,7 @@ msgstr ""
"(例: \"1024:2048\")を、クオーテーション無しで指定することができます。"
msgid "Member"
-msgstr ""
+msgstr "メンバー"
msgid "Member used"
msgstr "使用されるメンバー"
@@ -260,28 +281,31 @@ msgid "No"
msgstr "いいえ"
msgid "No MWAN interfaces found"
-msgstr ""
+msgstr "MWAN インターフェースが見つかりません"
msgid "No MWAN systemlog history found"
-msgstr ""
+msgstr "MWAN システムログの履歴が見つかりません"
msgid "No detailed status information available"
-msgstr ""
+msgstr "詳細ステータス情報は利用できません"
msgid "No diagnostic results returned"
-msgstr ""
+msgstr "診断結果がありません"
msgid "No protocol specified"
-msgstr ""
+msgstr "プロトコルが設定されていません"
msgid "Offline"
+msgstr "オフライン"
+
+msgid "Online"
msgstr ""
msgid "Online (tracking active)"
-msgstr ""
+msgstr "オンライン(追跡実行中)"
msgid "Online (tracking off)"
-msgstr ""
+msgstr "オンライン(追跡オフ)"
msgid "Overview"
msgstr "概要"
@@ -332,7 +356,7 @@ msgstr ""
"ターフェースやメンバー、ルールと同じ名前を使用することはできません。"
msgid "Policy"
-msgstr ""
+msgstr "ポリシー"
msgid "Policy assigned"
msgstr "アサイン済みポリシー"
@@ -353,7 +377,7 @@ msgid "Restore..."
msgstr "復元..."
msgid "Rule"
-msgstr ""
+msgstr "ルール"
msgid "Rules"
msgstr "ルール"
@@ -477,6 +501,11 @@ msgstr "トラブルシューティング"
msgid "Troubleshooting Data"
msgstr "トラブルシューティング データ"
+msgid ""
+"Use the IP address of this interface as source IP address for traffic "
+"initiated by the router itself"
+msgstr ""
+
msgid "View the contents of /etc/protocols for protocol descriptions"
msgstr "プロトコルの説明については、 /etc/protocols の内容を確認してください。"
@@ -575,10 +604,10 @@ msgstr ""
"いません!プロトコルを指定し直してください!"
msgid "Waiting for MWAN to %s..."
-msgstr ""
+msgstr "MWAN の %s を待っています..."
msgid "Waiting for diagnostic results..."
-msgstr ""
+msgstr "診断結果を待っています..."
msgid "Weight"
msgstr "ウエイト"
@@ -614,13 +643,13 @@ msgid "never"
msgstr "never"
msgid "restart"
-msgstr ""
+msgstr "再起動"
msgid "start"
-msgstr ""
+msgstr "起動"
msgid "stop"
-msgstr ""
+msgstr "停止"
msgid "unreachable (reject)"
msgstr "unreachable (reject)"
diff --git a/applications/luci-app-mwan3/po/templates/mwan3.pot b/applications/luci-app-mwan3/po/templates/mwan3.pot
index 3d25e844ac..9e17c3d040 100644
--- a/applications/luci-app-mwan3/po/templates/mwan3.pot
+++ b/applications/luci-app-mwan3/po/templates/mwan3.pot
@@ -79,6 +79,9 @@ msgstr ""
msgid "Errors"
msgstr ""
+msgid "Expect interface state on up event"
+msgstr ""
+
msgid "Failure interval"
msgstr ""
@@ -88,6 +91,12 @@ msgstr ""
msgid "Flush global firewall conntrack table on interface events"
msgstr ""
+msgid "Globals"
+msgstr ""
+
+msgid "Globals mwan3 options"
+msgstr ""
+
msgid "Hotplug Script"
msgstr ""
@@ -106,6 +115,9 @@ msgstr ""
msgid "IPv6"
msgstr ""
+msgid "Initial state"
+msgstr ""
+
msgid "Interface"
msgstr ""
@@ -127,6 +139,12 @@ msgstr ""
msgid "Internet Protocol"
msgstr ""
+msgid "Keep failure interval"
+msgstr ""
+
+msgid "Keep ping failure interval during failure state"
+msgstr ""
+
msgid "Last 50 MWAN systemlog entries. Newest entries sorted at the top :"
msgstr ""
@@ -139,6 +157,9 @@ msgstr ""
msgid "Loading"
msgstr ""
+msgid "Local source interface"
+msgstr ""
+
msgid "MWAN Config"
msgstr ""
@@ -245,6 +266,9 @@ msgstr ""
msgid "Offline"
msgstr ""
+msgid "Online"
+msgstr ""
+
msgid "Online (tracking active)"
msgstr ""
@@ -391,6 +415,9 @@ msgstr ""
msgid "Tracking hostname or IP address"
msgstr ""
+msgid "Tracking method"
+msgstr ""
+
msgid "Tracking reliability"
msgstr ""
@@ -408,6 +435,11 @@ msgstr ""
msgid "Troubleshooting Data"
msgstr ""
+msgid ""
+"Use the IP address of this interface as source IP address for traffic "
+"initiated by the router itself"
+msgstr ""
+
msgid "View the contents of /etc/protocols for protocol descriptions"
msgstr ""
diff --git a/applications/luci-app-mwan3/po/zh-cn/mwan3.po b/applications/luci-app-mwan3/po/zh-cn/mwan3.po
index 1e0f34f088..3c505d8477 100644
--- a/applications/luci-app-mwan3/po/zh-cn/mwan3.po
+++ b/applications/luci-app-mwan3/po/zh-cn/mwan3.po
@@ -82,6 +82,9 @@ msgstr "收集故障排除信息时出错"
msgid "Errors"
msgstr "错误"
+msgid "Expect interface state on up event"
+msgstr ""
+
msgid "Failure interval"
msgstr "故障检测间隔"
@@ -91,6 +94,12 @@ msgstr "刷新连接跟踪表"
msgid "Flush global firewall conntrack table on interface events"
msgstr "在接口事件触发时刷新全局防火墙连接跟踪表"
+msgid "Globals"
+msgstr ""
+
+msgid "Globals mwan3 options"
+msgstr ""
+
msgid "Hotplug Script"
msgstr "Hotplug 脚本"
@@ -109,6 +118,9 @@ msgstr "IPv4"
msgid "IPv6"
msgstr "IPv6"
+msgid "Initial state"
+msgstr ""
+
msgid "Interface"
msgstr "接口"
@@ -130,6 +142,12 @@ msgstr "接口"
msgid "Internet Protocol"
msgstr "互联网协议"
+msgid "Keep failure interval"
+msgstr ""
+
+msgid "Keep ping failure interval during failure state"
+msgstr ""
+
msgid "Last 50 MWAN systemlog entries. Newest entries sorted at the top :"
msgstr "最近 50 条 MWAN 系统日志,最新条目排在顶部:"
@@ -142,6 +160,9 @@ msgstr "负载均衡"
msgid "Loading"
msgstr "载入中"
+msgid "Local source interface"
+msgstr ""
+
msgid "MWAN Config"
msgstr "MWAN 配置文件"
@@ -260,6 +281,9 @@ msgstr "未指定协议"
msgid "Offline"
msgstr "离线"
+msgid "Online"
+msgstr ""
+
msgid "Online (tracking active)"
msgstr "在线(追踪启用中)"
@@ -443,6 +467,11 @@ msgstr "故障排除"
msgid "Troubleshooting Data"
msgstr "故障排除数据"
+msgid ""
+"Use the IP address of this interface as source IP address for traffic "
+"initiated by the router itself"
+msgstr ""
+
msgid "View the contents of /etc/protocols for protocol descriptions"
msgstr "请查看 /etc/protocols 获取可选协议详情"
diff --git a/applications/luci-app-mwan3/root/etc/uci-defaults/60_luci-mwan3 b/applications/luci-app-mwan3/root/etc/uci-defaults/60_luci-mwan3
index ff9a229edd..509a694364 100755
--- a/applications/luci-app-mwan3/root/etc/uci-defaults/60_luci-mwan3
+++ b/applications/luci-app-mwan3/root/etc/uci-defaults/60_luci-mwan3
@@ -8,6 +8,13 @@ uci -q batch <<-EOF >/dev/null
commit ucitrack
EOF
+uci -q get mwan3.globals >/dev/null || {
+ uci -q add mwan3 globals >/dev/null
+ uci -q rename mwan3.@globals[-1]="globals" >/dev/null
+ uci -q set mwan3.globals.initial_source="none" >/dev/null
+ uci commit mwan3
+}
+
# remove LuCI cache
rm -rf /tmp/luci-indexcache /tmp/luci-modulecache