diff --git a/luci-app-mptcp/luasrc/controller/mptcp.lua b/luci-app-mptcp/luasrc/controller/mptcp.lua index 842adc6ef7..98e07b4920 100755 --- a/luci-app-mptcp/luasrc/controller/mptcp.lua +++ b/luci-app-mptcp/luasrc/controller/mptcp.lua @@ -5,13 +5,17 @@ module("luci.controller.mptcp", package.seeall) +local uname = nixio.uname() + function index() entry({"admin", "network", "mptcp"}, alias("admin", "network", "mptcp", "settings"), _("MPTCP")) entry({"admin", "network", "mptcp", "settings"}, cbi("mptcp"), _("Settings"),2).leaf = true entry({"admin", "network", "mptcp", "bandwidth"}, template("mptcp/multipath"), _("Bandwidth"), 3).leaf = true entry({"admin", "network", "mptcp", "multipath_bandwidth"}, call("multipath_bandwidth")).leaf = true entry({"admin", "network", "mptcp", "interface_bandwidth"}, call("interface_bandwidth")).leaf = true - entry({"admin", "network", "mptcp", "mptcp_check"}, template("mptcp/mptcp_check"), _("MPTCP Support Check"), 4).leaf = true + if uname.release:sub(1,1) == "5" then + entry({"admin", "network", "mptcp", "mptcp_check"}, template("mptcp/mptcp_check"), _("MPTCP Support Check"), 4).leaf = true + end entry({"admin", "network", "mptcp", "mptcp_check_trace"}, post("mptcp_check_trace")).leaf = true entry({"admin", "network", "mptcp", "mptcp_fullmesh"}, template("mptcp/mptcp_fullmesh"), _("MPTCP Fullmesh"), 5).leaf = true entry({"admin", "network", "mptcp", "mptcp_fullmesh_data"}, post("mptcp_fullmesh_data")).leaf = true diff --git a/luci-app-mptcp/luasrc/model/cbi/mptcp.lua b/luci-app-mptcp/luasrc/model/cbi/mptcp.lua index c4756ad653..ef54c14991 100755 --- a/luci-app-mptcp/luasrc/model/cbi/mptcp.lua +++ b/luci-app-mptcp/luasrc/model/cbi/mptcp.lua @@ -183,5 +183,8 @@ o:value("backup", translate("backup")) --o:value("handover", translate("handover")) o.default = "off" +function m.on_after_apply(self,map) + sys.call('/etc/init.d/mptcp reload') +end return m diff --git a/mptcp/files/usr/share/omr/post-tracking.d/010-services b/mptcp/files/usr/share/omr/post-tracking.d/010-services index 4268caa61a..4cc11015b1 100755 --- a/mptcp/files/usr/share/omr/post-tracking.d/010-services +++ b/mptcp/files/usr/share/omr/post-tracking.d/010-services @@ -134,6 +134,16 @@ restart_omrtracker() { config_load network config_foreach restart_omrtracker interface +mutlipath_fix() { + config_get multipath "$1" multipath + [ "$multipath" != "off" ] && return + interface="$(ifstatus $1 | jsonfilter -q -e '@.l3_device' | tr -d '\n')" + [ -n "$interface"] && [ -z "$(multipath $interface | grep deactivated)" ] && /etc/init.d/mptcp reload $interface 2>&1 >/dev/null +} + +config_load network +config_foreach multipath_fix interface + if [ -f /etc/init.d/shadowsocks-libev ] && [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && [ "$(uci -q get shadowsocks-libev.sss0.key)" != "" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "192.18.1.3" ] && [ "$(pgrep -f omr-tracker-ss)" = "" ] && [ "$(pgrep -f '/etc/init.d/omr-tracker')" = "" ]; then _log "Can't find omr-tracker-ss for Shadowsocks libev, restart omr-tracker..." /etc/init.d/omr-tracker restart 2>&1 >/dev/null diff --git a/omr-tracker/files/bin/omr-tracker-server b/omr-tracker/files/bin/omr-tracker-server index ef80e90865..fcab8b2d48 100755 --- a/omr-tracker/files/bin/omr-tracker-server +++ b/omr-tracker/files/bin/omr-tracker-server @@ -64,14 +64,16 @@ _check_master() { config_get disabled $1 disabled [ "$master" = "1" ] && [ -n "$ip" ] && [ "$disabled" != "1" ] && { set_ip() { - local ip=$1 - ipresolve="$(resolveip -4 $ip | head -n 1)" + local ipd=$1 + local ip="" + ipresolve="$(resolveip -4 $ipd | head -n 1)" if [ -n "$ipresolve" ]; then ip="$ipresolve" else - ip6resolve="$(resolveip -6 $ip | head -n 1)" + ip6resolve="$(resolveip -6 $ipd | head -n 1)" [ -n "$ip6resolve" ] && ip="$ip6resolve" fi + [ -z "$ip" ] && return #_ping_server $ip _check_server $ip $port if [ "$server_ping" = true ]; then diff --git a/openmptcprouter-api/files/usr/libexec/rpcd/openmptcprouter b/openmptcprouter-api/files/usr/libexec/rpcd/openmptcprouter index 340fbf77c6..f28df60c15 100755 --- a/openmptcprouter-api/files/usr/libexec/rpcd/openmptcprouter +++ b/openmptcprouter-api/files/usr/libexec/rpcd/openmptcprouter @@ -8,6 +8,11 @@ local net = require "luci.model.network".init() local ucic = require "luci.model.uci".cursor() local jsonc = require "luci.jsonc" +function file_exists(name) + local f = io.open(name, "r") + return f ~= nil and io.close(f) +end + function interface_from_device(dev) for _, iface in ipairs(net:get_networks()) do local ifacen = iface:name() @@ -1183,7 +1188,8 @@ function interfaces_status() mArray.openmptcprouter['model'] = sys.exec("ubus call system board | jsonfilter -q -e '@.model' 2>/dev/null | tr -d '\n'") local board_name = sys.exec("ubus call system board | jsonfilter -q -e '@.board_name' 2>/dev/null | tr -d '\n'") -- retrieve core temperature - if board_name:match("^raspberrypi.*") then + --if board_name:match("^raspberrypi.*") then + if file_exists("/sys/class/thermal/thermal_zone0/temp") then mArray.openmptcprouter["core_temp"] = sys.exec("cat /sys/class/thermal/thermal_zone0/temp 2>/dev/null"):match("%d+") end mArray.openmptcprouter["loadavg"] = sys.exec("cat /proc/loadavg 2>/dev/null"):match("[%d%.]+ [%d%.]+ [%d%.]+")