mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
sync (#389)
This commit is contained in:
commit
18b226bfd3
5 changed files with 30 additions and 5 deletions
|
@ -5,13 +5,17 @@
|
||||||
|
|
||||||
module("luci.controller.mptcp", package.seeall)
|
module("luci.controller.mptcp", package.seeall)
|
||||||
|
|
||||||
|
local uname = nixio.uname()
|
||||||
|
|
||||||
function index()
|
function index()
|
||||||
entry({"admin", "network", "mptcp"}, alias("admin", "network", "mptcp", "settings"), _("MPTCP"))
|
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", "settings"}, cbi("mptcp"), _("Settings"),2).leaf = true
|
||||||
entry({"admin", "network", "mptcp", "bandwidth"}, template("mptcp/multipath"), _("Bandwidth"), 3).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", "multipath_bandwidth"}, call("multipath_bandwidth")).leaf = true
|
||||||
entry({"admin", "network", "mptcp", "interface_bandwidth"}, call("interface_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_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"}, template("mptcp/mptcp_fullmesh"), _("MPTCP Fullmesh"), 5).leaf = true
|
||||||
entry({"admin", "network", "mptcp", "mptcp_fullmesh_data"}, post("mptcp_fullmesh_data")).leaf = true
|
entry({"admin", "network", "mptcp", "mptcp_fullmesh_data"}, post("mptcp_fullmesh_data")).leaf = true
|
||||||
|
|
|
@ -183,5 +183,8 @@ o:value("backup", translate("backup"))
|
||||||
--o:value("handover", translate("handover"))
|
--o:value("handover", translate("handover"))
|
||||||
o.default = "off"
|
o.default = "off"
|
||||||
|
|
||||||
|
function m.on_after_apply(self,map)
|
||||||
|
sys.call('/etc/init.d/mptcp reload')
|
||||||
|
end
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
|
|
@ -134,6 +134,16 @@ restart_omrtracker() {
|
||||||
config_load network
|
config_load network
|
||||||
config_foreach restart_omrtracker interface
|
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
|
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..."
|
_log "Can't find omr-tracker-ss for Shadowsocks libev, restart omr-tracker..."
|
||||||
/etc/init.d/omr-tracker restart 2>&1 >/dev/null
|
/etc/init.d/omr-tracker restart 2>&1 >/dev/null
|
||||||
|
|
|
@ -64,14 +64,16 @@ _check_master() {
|
||||||
config_get disabled $1 disabled
|
config_get disabled $1 disabled
|
||||||
[ "$master" = "1" ] && [ -n "$ip" ] && [ "$disabled" != "1" ] && {
|
[ "$master" = "1" ] && [ -n "$ip" ] && [ "$disabled" != "1" ] && {
|
||||||
set_ip() {
|
set_ip() {
|
||||||
local ip=$1
|
local ipd=$1
|
||||||
ipresolve="$(resolveip -4 $ip | head -n 1)"
|
local ip=""
|
||||||
|
ipresolve="$(resolveip -4 $ipd | head -n 1)"
|
||||||
if [ -n "$ipresolve" ]; then
|
if [ -n "$ipresolve" ]; then
|
||||||
ip="$ipresolve"
|
ip="$ipresolve"
|
||||||
else
|
else
|
||||||
ip6resolve="$(resolveip -6 $ip | head -n 1)"
|
ip6resolve="$(resolveip -6 $ipd | head -n 1)"
|
||||||
[ -n "$ip6resolve" ] && ip="$ip6resolve"
|
[ -n "$ip6resolve" ] && ip="$ip6resolve"
|
||||||
fi
|
fi
|
||||||
|
[ -z "$ip" ] && return
|
||||||
#_ping_server $ip
|
#_ping_server $ip
|
||||||
_check_server $ip $port
|
_check_server $ip $port
|
||||||
if [ "$server_ping" = true ]; then
|
if [ "$server_ping" = true ]; then
|
||||||
|
|
|
@ -8,6 +8,11 @@ local net = require "luci.model.network".init()
|
||||||
local ucic = require "luci.model.uci".cursor()
|
local ucic = require "luci.model.uci".cursor()
|
||||||
local jsonc = require "luci.jsonc"
|
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)
|
function interface_from_device(dev)
|
||||||
for _, iface in ipairs(net:get_networks()) do
|
for _, iface in ipairs(net:get_networks()) do
|
||||||
local ifacen = iface:name()
|
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'")
|
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'")
|
local board_name = sys.exec("ubus call system board | jsonfilter -q -e '@.board_name' 2>/dev/null | tr -d '\n'")
|
||||||
-- retrieve core temperature
|
-- 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+")
|
mArray.openmptcprouter["core_temp"] = sys.exec("cat /sys/class/thermal/thermal_zone0/temp 2>/dev/null"):match("%d+")
|
||||||
end
|
end
|
||||||
mArray.openmptcprouter["loadavg"] = sys.exec("cat /proc/loadavg 2>/dev/null"):match("[%d%.]+ [%d%.]+ [%d%.]+")
|
mArray.openmptcprouter["loadavg"] = sys.exec("cat /proc/loadavg 2>/dev/null"):match("[%d%.]+ [%d%.]+ [%d%.]+")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue