Skip to content

Commit

Permalink
Merge pull request #342 from Ysurac/develop
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
suyuan168 authored Aug 10, 2023
2 parents 8b4d73a + 9faa13a commit 85822a5
Show file tree
Hide file tree
Showing 8 changed files with 783 additions and 68 deletions.
11 changes: 7 additions & 4 deletions luci-app-mptcp/luasrc/model/cbi/mptcp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ end

-- if tonumber(uname.release:sub(1,4)) >= 5.15 then
if uname.release:sub(1,4) == "5.15" or uname.release:sub(1,1) == "6" then
o = s:option(ListValue, "mptcp_pm_type", translate("Path Manager type"))
o:value(0, translate("In-kernel path manager"))
o:value(1, translate("Userspace path manager"))
o.default = 0
if uname.release:sub(1,1) == "6" then
-- Only available since 5.19
o = s:option(ListValue, "mptcp_pm_type", translate("Path Manager type"))
o:value(0, translate("In-kernel path manager"))
o:value(1, translate("Userspace path manager"))
o.default = 0
end

o = s:option(Value, "mptcp_subflows", translate("Max subflows"),translate("specifies the maximum number of additional subflows allowed for each MPTCP connection"))
o.datatype = "uinteger"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ function wizard_add()
end
ucic:set("openmptcprouter",intf,"testspeed",testspeed)
if testspeed == "1" then
ucic:set("openmptcprouter",intf,"testspeed_lc")
ucic:delete("openmptcprouter",intf,"testspeed_lc")
end
if downloadspeed ~= "0" and downloadspeed ~= "" then
if sqmautorate == "1" and (ucic:get("network",intf,"downloadspeed") ~= downloadspeed or ucic:get("sqm",intf,"max_download") == "" or ucic:get("sqm",intf,"download") == "0") then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ pinger_binary=$(uci -q get sqm.${INTERFACE}.pinger || echo 'tsping')
# so e.g. if 6 reflectors are specified and the number of pingers is set to 4, the first 4 reflectors will be used initially
# and the remaining 2 reflectors in the list will be used in the event any of the first 4 go bad
# a bad reflector will go to the back of the queue on reflector rotation
#reflectors=$(uci -q get omr-tracker.defaults.hosts)
reflectors=(
"1.1.1.1" "1.0.0.1" # Cloudflare
"8.8.8.8" "8.8.4.4" # Google
"9.9.9.9" "9.9.9.10" "9.9.9.11" # Quad9
"94.140.14.15" "94.140.14.140" "94.140.14.141" "94.140.15.15" "94.140.15.16" # AdGuard
"64.6.65.6" "156.154.70.1" "156.154.70.2" "156.154.70.3" "156.154.70.4" "156.154.70.5" "156.154.71.1" "156.154.71.2" "156.154.71.3" "156.154.71.4" "156.154.71.5" # Neustar
"208.67.220.2" "208.67.220.123" "208.67.220.220" "208.67.222.2" "208.67.222.123" # OpenDNS
"185.228.168.9" "185.228.168.10" # CleanBrowsing
)
reflectors=( $(uci -q get omr-tracker.defaults.hosts) )
#reflectors=(
#"1.1.1.1" "1.0.0.1" # Cloudflare
#"8.8.8.8" "8.8.4.4" # Google
#"9.9.9.9" "9.9.9.10" "9.9.9.11" # Quad9
#"94.140.14.15" "94.140.14.140" "94.140.14.141" "94.140.15.15" "94.140.15.16" # AdGuard
#"64.6.65.6" "156.154.70.1" "156.154.70.2" "156.154.70.3" "156.154.70.4" "156.154.70.5" "156.154.71.1" "156.154.71.2" "156.154.71.3" "156.154.71.4" "156.154.71.5" # Neustar
#"208.67.220.2" "208.67.220.123" "208.67.220.220" "208.67.222.2" "208.67.222.123" # OpenDNS
#"185.228.168.9" "185.228.168.10" # CleanBrowsing
#)

randomize_reflectors=1 # enable (1) or disable (0) randomization of reflectors on startup

Expand Down
12 changes: 7 additions & 5 deletions mptcp/files/etc/init.d/mptcp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ global_multipath_settings() {
config_get mptcp_rr_num_segments globals mptcp_rr_num_segments
config_get mptcp_version globals mptcp_version "0"
config_get mptcp_stale_loss_cnt globals mptcp_stale_loss_cnt "4"
config_get mptcp_pm_type globals mptcp_pm_type "1"

[ "$multipath" = "enable" ] && multipath_status=1

Expand All @@ -52,11 +53,10 @@ global_multipath_settings() {
ip mptcp limits set add_addr_accepted $mptcp_add_addr_accepted subflows $mptcp_subflows 2>&1 >/dev/null
#[ -z "$mptcp_debug" ] || sysctl -qew net.mptcp.mptcp_debug="$mptcp_debug"
[ -z "$mptcp_checksum" ] || sysctl -qew net.mptcp.mptcp_checksum="$mptcp_checksum"
[ -z "$mptcp_path_manager" ] || sysctl -qew net.mptcp.mptcp_path_manager="$mptcp_path_manager"
[ -z "$mptcp_scheduler" ] || sysctl -qew net.mptcp.mptcp_scheduler="$mptcp_scheduler"
[ -z "$mptcp_add_addr_timeout" ] || sysctl -qew net.mptcp.add_addr_timeout="$mptcp_add_addr_timeout"
[ -z "$mptcp_checksum" ] || sysctl -qew net.mptcp.checksum_enabled="$mptcp_checksum"
[ -z "$mptcp_stale_loss_cnt" ] || sysctl -qew net.mptcp.stale_loss_cnt="$mptcp_stale_loss_cnt"
[ -z "$mptcp_pm_type" ] || sysctl -qew net.mptcp.pm_type="$mptcp_pm_type"
fi
[ -z "$congestion" ] || sysctl -qew net.ipv4.tcp_congestion_control="$congestion"
}
Expand Down Expand Up @@ -195,10 +195,12 @@ interface_multipath_settings() {

#echo "îface: $iface"

if [ "$mode" = "master" ]; then
if [ "$(uci -q get openmptcprouter.settings.force_multipath)" != "0" ]; then
if [ "$mode" = "master" ]; then
multipath "$iface" "on"
else
multipath "$iface" "$mode"
else
multipath "$iface" "$mode"
fi
fi
#[ "$mode" = "off" ] && {
# ip rule del table $id > /dev/null 2>&1
Expand Down
85 changes: 46 additions & 39 deletions mptcp/files/usr/share/omr/post-tracking.d/post-tracking
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ if [ -n "$OMR_TRACKER_INTERFACE" ] && ([ "$multipath_config" = "on" ] || [ "$mul
config_load openmptcprouter
config_foreach glorytunudppath server
fi
[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" != "1" ] && {
[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" != "1" ] && [ "$(uci -q get openmptcprouter.settings.force_multipath)" != "0" ] && {
[ "$multipath_status" = "$multipath_config" ] || {
if [ "$(sysctl -qen net.mptcp.mptcp_enabled | tr -d '\n')" = "1" ] || [ "$(sysctl -qen net.mptcp.enabled | tr -d '\n')" = "1" ]; then
if [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.force_link)" != "0" ]; then
Expand Down Expand Up @@ -1610,48 +1610,55 @@ if [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ]; then
fi

if [ "$(pgrep -f omr-test-speed-server)" = "" ] && [ "$(uci -q get openmptcprouter.${OMR_TRACKER_INTERFACE}.testspeed)" = "1" ] && [ -z "$(uci -q get openmptcprouter.${OMR_TRACKER_INTERFACE}.testspeed_lc)" ]; then
download_speed=$(/bin/omr-test-speed-server vps ${OMR_TRACKER_DEVICE} fasttest)
download_speed2=$(/bin/omr-test-speed-server vps ${OMR_TRACKER_DEVICE} fasttest)
download_speed3=$(/bin/omr-test-speed-server vps ${OMR_TRACKER_DEVICE} fasttest)
[ "$download_speed2" -gt "$download_speed" ] && download_speed=${download_speed2}
[ "$download_speed3" -gt "$download_speed" ] && download_speed=${download_speed3}
download_speed=$((download_speed/1000))
if [ -n "$download_speed" ] && [ "$download_speed" != "0" ]; then
upload_speed=$(/bin/omr-test-speed-server vps ${OMR_TRACKER_DEVICE} fasttest upload)
upload_speed2=$(/bin/omr-test-speed-server vps ${OMR_TRACKER_DEVICE} fasttest upload)
upload_speed3=$(/bin/omr-test-speed-server vps ${OMR_TRACKER_DEVICE} fasttest upload)
[ "$upload_speed2" -gt "$upload_speed" ] && upload_speed=${upload_speed2}
[ "$upload_speed3" -gt "$upload_speed" ] && upload_speed=${upload_speed3}

# Set Download speed settings
if [ "$(uci -q get sqm.${OMR_TRACKER_INTERFACE}.autorate)" = "1" ]; then
uci -q set sqm.${OMR_TRACKER_INTERFACE}.download=$((download_speed*65/100))
uci -q set sqm.${OMR_TRACKER_INTERFACE}.max_download=${download_speed}
uci -q set sqm.${OMR_TRACKER_INTERFACE}.min_download=$((download_speed*10/100))
else
uci -q set sqm.${OMR_TRACKER_INTERFACE}.download=$((download_speed*95/100))
fi
_log "Calculated ${OMR_TRACKER_INTERFACE} download speed: ${download_speed}"
uci -q set network.${OMR_TRACKER_INTERFACE}.downloadspeed=${download_speed}

# Set Upload speed settings
upload_speed=$((upload_speed/1000))
if [ -n "$upload_speed" ] && [ "$upload_speed" != "0" ]; then
launch_speedtest() {
local server=$1
[ "$(uci -q get openmptcprouter.${server}.current)" != "1" ] && return
download_speed=$(/bin/omr-test-speed-server ${server} ${OMR_TRACKER_DEVICE} fasttest)
download_speed2=$(/bin/omr-test-speed-server ${server} ${OMR_TRACKER_DEVICE} fasttest)
download_speed3=$(/bin/omr-test-speed-server ${server} ${OMR_TRACKER_DEVICE} fasttest)
[ "$download_speed2" -gt "$download_speed" ] && download_speed=${download_speed2}
[ "$download_speed3" -gt "$download_speed" ] && download_speed=${download_speed3}
download_speed=$((download_speed/1000))
if [ -n "$download_speed" ] && [ "$download_speed" != "0" ]; then
upload_speed=$(/bin/omr-test-speed-server ${server} ${OMR_TRACKER_DEVICE} fasttest upload)
upload_speed2=$(/bin/omr-test-speed-server ${server} ${OMR_TRACKER_DEVICE} fasttest upload)
upload_speed3=$(/bin/omr-test-speed-server ${server} ${OMR_TRACKER_DEVICE} fasttest upload)
[ "$upload_speed2" -gt "$upload_speed" ] && upload_speed=${upload_speed2}
[ "$upload_speed3" -gt "$upload_speed" ] && upload_speed=${upload_speed3}

# Set Download speed settings
if [ "$(uci -q get sqm.${OMR_TRACKER_INTERFACE}.autorate)" = "1" ]; then
uci -q set sqm.${OMR_TRACKER_INTERFACE}.upload=$((upload_speed*65/100))
uci -q set sqm.${OMR_TRACKER_INTERFACE}.max_upload=${upload_speed}
uci -q set sqm.${OMR_TRACKER_INTERFACE}.min_upload=$((upload_speed*10/100))
uci -q set sqm.${OMR_TRACKER_INTERFACE}.download=$((download_speed*65/100))
uci -q set sqm.${OMR_TRACKER_INTERFACE}.max_download=${download_speed}
uci -q set sqm.${OMR_TRACKER_INTERFACE}.min_download=$((download_speed*10/100))
else
uci -q set sqm.${OMR_TRACKER_INTERFACE}.upload=$((upload_speed*95/100))
uci -q set sqm.${OMR_TRACKER_INTERFACE}.download=$((download_speed*95/100))
fi
_log "Calculated ${OMR_TRACKER_INTERFACE} download speed: ${download_speed}"
uci -q set network.${OMR_TRACKER_INTERFACE}.downloadspeed=${download_speed}

# Set Upload speed settings
upload_speed=$((upload_speed/1000))
if [ -n "$upload_speed" ] && [ "$upload_speed" != "0" ]; then
if [ "$(uci -q get sqm.${OMR_TRACKER_INTERFACE}.autorate)" = "1" ]; then
uci -q set sqm.${OMR_TRACKER_INTERFACE}.upload=$((upload_speed*65/100))
uci -q set sqm.${OMR_TRACKER_INTERFACE}.max_upload=${upload_speed}
uci -q set sqm.${OMR_TRACKER_INTERFACE}.min_upload=$((upload_speed*10/100))
else
uci -q set sqm.${OMR_TRACKER_INTERFACE}.upload=$((upload_speed*95/100))
fi
_log "Calculated ${OMR_TRACKER_INTERFACE} upload speed: ${upload_speed}"
uci -q set network.${OMR_TRACKER_INTERFACE}.uploadspeed=${upload_speed}
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.testspeed_lc=$(date +"%s")
uci commit network
uci commit sqm
uci commit openmptcprouter
fi
_log "Calculated ${OMR_TRACKER_INTERFACE} upload speed: ${upload_speed}"
uci -q set network.${OMR_TRACKER_INTERFACE}.uploadspeed=${upload_speed}
fi
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.testspeed_lc=$(date +"%s")
uci commit network
uci commit sqm
uci commit openmptcprouter
fi
}
config_load openmptcprouter
config_foreach launch_speedtest server

sleep 5
fi

Expand Down
8 changes: 4 additions & 4 deletions mptcpd/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2020-2022 Ycarus (Yannick Chabanois) <[email protected]> for OpenMPTCProuter project
# Copyright (C) 2020-2023 Ycarus (Yannick Chabanois) <[email protected]> for OpenMPTCProuter project
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
Expand All @@ -9,9 +9,9 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=mptcpd
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/intel/mptcpd.git
PKG_SOURCE_VERSION:=88bea6802379ee1cdbcba4817351b63fd1489537
PKG_VERSION:=0.9-$(PKG_SOURCE_VERSION)
PKG_SOURCE_URL:=https://github.com/multipath-tcp/mptcpd.git
PKG_SOURCE_VERSION:=863e83f255f55dfd0ba9325d816bd99f6d9da0c2
PKG_VERSION:=0.12-$(PKG_SOURCE_VERSION)
PKG_RELEASE:=1
PKG_MAINTAINER:=Ycarus (Yannick Chabanois) <[email protected]>

Expand Down
Loading

0 comments on commit 85822a5

Please sign in to comment.