Skip to content

Commit

Permalink
sync (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
suyuan168 authored Dec 11, 2023
2 parents dbdd374 + e9fda36 commit 18b226b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
6 changes: 5 additions & 1 deletion luci-app-mptcp/luasrc/controller/mptcp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions luci-app-mptcp/luasrc/model/cbi/mptcp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions mptcp/files/usr/share/omr/post-tracking.d/010-services
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions omr-tracker/files/bin/omr-tracker-server
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion openmptcprouter-api/files/usr/libexec/rpcd/openmptcprouter
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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%.]+")
Expand Down

0 comments on commit 18b226b

Please sign in to comment.