Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync #343

Merged
merged 9 commits into from
Aug 12, 2023
Merged

sync #343

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion glorytun/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=glorytun
PKG_RELEASE:=6
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=1af1e26ad7a325d891c27f5cf9832c1ce4b4d0e9
PKG_SOURCE_VERSION:=0c3b03cf0215e0896fd8e7e91be92efa77f6a2d1
PKG_SOURCE:=glorytun-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/Ysurac/glorytun.git
PKG_VERSION:=0.0.35-$(PKG_SOURCE_VERSION)
Expand Down
2 changes: 1 addition & 1 deletion glorytun/init
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ start_instance() {
retry count -1 const 5000000 \
timeout ${timeout} \
keepalive count 5 idle 20 interval 2 \
buffer-size 32768
buffer-size 327680

procd_set_param respawn 0 30 0
procd_set_param file /tmp/${PROG_NAME}-${1}.key
Expand Down
43 changes: 43 additions & 0 deletions luci-app-mptcp/luasrc/model/cbi/mptcp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,49 @@ if uname.release:sub(1,4) == "5.15" or uname.release:sub(1,1) == "6" then
o.default = 0
end

o = s:option(ListValue, "mptcp_disable_initial_config", translate("Initial MPTCP configuration"))
o:depends("mptcp_pm_type",1)
o:value("0", translate("enable"))
o:value("1", translate("disable"))
o.default = "0"

o = s:option(ListValue, "mptcp_force_multipath", translate("Force Multipath configuration"))
o:depends("mptcp_pm_type",1)
o:value("1", translate("enable"))
o:value("0", translate("disable"))
o.default = "1"

o = s:option(ListValue, "mptcpd_enable", translate("Enable MPTCPd"))
o:depends("mptcp_pm_type",1)
o:value("enable", translate("enable"))
o:value("disable", translate("disable"))
o.default = "disable"

o = s:option(DynamicList, "mptcpd_path_manager", translate("MPTCPd path managers"))
for dir in io.popen([[cd /usr/lib/mptcpd && ls -1 *.so | sed 's/.so//g']]):lines() do
o:value(dir, dir)
end
o:depends("mptcp_pm_type",1)

o = s:option(DynamicList, "mptcpd_plugins", translate("MPTCPd plugins"))
for dir in io.popen([[cd /usr/lib/mptcpd && ls -1 *.so | sed 's/.so//g']]):lines() do
o:value(dir, dir)
end
o:depends("mptcp_pm_type",1)

o = s:option(DynamicList, "mptcpd_addr_flags", translate("MPTCPd Address annoucement flags"))
o:value("subflow","subflow")
o:value("signal","signal")
o:value("backup","backup")
o:value("fullmesh","fullmesh")
o:depends("mptcp_pm_type",1)

o = s:option(DynamicList, "mptcpd_notify_flags", translate("MPTCPd Address notification flags"))
o:value("existing","existing")
o:value("skip_link_local","skip_link_local")
o:value("skip_loopback","skip_loopback")
o:depends("mptcp_pm_type",1)

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"
o.rmempty = false
Expand Down
27 changes: 16 additions & 11 deletions luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -556,17 +556,22 @@ function wizard_add()
vpn_intf = "bonding-omrvpn"
ucic:set("network","omrvpn","proto","bonding")
end
if downloadmax ~= 0 and uploadmax ~= 0 then
--ucic:set("sqm","omrvpn","enabled","1")
ucic:set("sqm","omrvpn","max_download",downloadmax)
ucic:set("sqm","omrvpn","max_upload",uploadmax)
ucic:set("sqm","omrvpn","download",math.ceil(downloadmax*50/100))
ucic:set("sqm","omrvpn","min_download",math.ceil(downloadmax*8/100))
ucic:set("sqm","omrvpn","upload",math.ceil(uploadmax*50/100))
ucic:set("sqm","omrvpn","min_upload",math.ceil(uploadmax*8/100))
else
ucic:set("sqm","omrvpn","enabled","0")
end
--if downloadmax ~= 0 and uploadmax ~= 0 then
-- ucic:set("sqm","omrvpn","enabled","1")
-- ucic:set("sqm","omrvpn","max_download",downloadmax)
-- ucic:set("sqm","omrvpn","max_upload",uploadmax)
-- ucic:set("sqm","omrvpn","download",math.ceil(downloadmax*50/100))
-- ucic:set("sqm","omrvpn","min_download",math.ceil(downloadmax*8/100))
-- ucic:set("sqm","omrvpn","upload",math.ceil(uploadmax*50/100))
-- ucic:set("sqm","omrvpn","min_upload",math.ceil(uploadmax*8/100))
--else
-- ucic:set("sqm","omrvpn","enabled","0")
--end

ucic:set("sqm","omrvpn","enabled","1")
ucic:set("sqm","omrvpn","download","0")
ucic:set("sqm","omrvpn","upload","0")

if vpn_intf ~= "" then
ucic:set("network","omrvpn","device",vpn_intf)
ucic:set("sqm","omrvpn","interface",vpn_intf)
Expand Down
2 changes: 1 addition & 1 deletion luci-app-sqm-autorate/root/etc/init.d/sqm-autorate
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
. /lib/functions/network.sh

_config_autorate() {
logger -t "SQM-autorate" "Set config for $1"
config_get enabled "$1" enabled
[ "${enabled}" != "1" ] && return
config_get autorate "$1" autorate
[ "${autorate}" != "1" ] && return
logger -t "SQM-autorate" "Set config for $1"

config_get min_download "$1" min_download "0"
config_get download "$1" download "0"
Expand Down
8 changes: 5 additions & 3 deletions mptcp/files/etc/init.d/mptcp
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,12 @@ start_service() {
ip route flush cache
ip -6 route flush cache
}
config_foreach interface_multipath_settings interface $intf
if [ "$(uci -q get network.globals.mptcp_disable_initial_config)" != "1" ]; then
config_foreach interface_multipath_settings interface $intf
config_foreach add_route route
config_foreach add_route6 route6
fi
set_multipath
config_foreach add_route route
config_foreach add_route6 route6
# If no master is defined, one interface is defined as master
if [ "$master" = "" ] && [ "$intf" = "" ]; then
intfmaster="$mptcpmintf"
Expand Down
4 changes: 4 additions & 0 deletions mptcp/files/etc/uci-defaults/mptcp-defaults
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ if [ "$(uci -q get network.globals.mptcp_path_manager)" = "" ]; then
set network.globals.mptcp_subflows=3
set network.globals.mptcp_add_addr_accepted=1
set network.globals.mptcp_add_addr_timeout=120
set network.globals.mptcp_pm_type=0
set network.globals.mptcp_disable_initial_config=0
set network.globals.mptcp_force_multipath=1
set network.globals.mptcpd_enable=0
commit network
EOF
fi
Expand Down
6 changes: 3 additions & 3 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.settings.force_multipath)" != "0" ] && {
[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" != "1" ] && [ "$(uci -q get network.globals.mptcp_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 @@ -1618,7 +1618,7 @@ if [ "$(pgrep -f omr-test-speed-server)" = "" ] && [ "$(uci -q get openmptcprout
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))
download_speed=$((download_speed*8/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)
Expand All @@ -1638,7 +1638,7 @@ if [ "$(pgrep -f omr-test-speed-server)" = "" ] && [ "$(uci -q get openmptcprout
uci -q set network.${OMR_TRACKER_INTERFACE}.downloadspeed=${download_speed}

# Set Upload speed settings
upload_speed=$((upload_speed/1000))
upload_speed=$((upload_speed*8/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))
Expand Down
1 change: 1 addition & 0 deletions mptcpd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ define Package/$(PKG_NAME)/install
$(CP) $(PKG_INSTALL_DIR)/usr/lib/mptcpd/* $(1)/usr/lib/mptcpd/
$(INSTALL_DIR) $(1)/etc/mptcpd
$(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/mptcpd.conf $(1)/etc/mptcpd/mptcpd.conf
$(CP) ./files/* $(1)/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
71 changes: 71 additions & 0 deletions mptcpd/files/etc/init.d/mptcpd
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2023 Ycarus (Yannick Chabanois) <[email protected]> for OpenMPTCProuter project

START=10
STOP=10

USE_PROCD=1
PROG_NAME=mptcpd
PROG=/usr/bin/${PROG_NAME}

_log() {
logger -p daemon.info -t ${PROG_NAME} "$@"
}

_err() {
logger -p daemon.err -t ${PROG_NAME} "$@"
}

version_over_5_4() {
MAJOR_VERSION=$(uname -r | awk -F '.' '{print $1}')
MINOR_VERSION=$(uname -r | awk -F '.' '{print $2}')
if [ $MAJOR_VERSION -ge 5 ] && [ $MINOR_VERSION -gt 13 ] || [ $MAJOR_VERSION -gt 5 ] ; then
return 0
else
return 1
fi
}

validate_section() {
uci_validate_section network globals "${1}" \
'mptcpd_enable:string:"disabled"' \
'mptcp_pm_type:bool:0' \
'mptcpd_path_manager:list(string)' \
'mptcpd_plugins:list(string)' \
'mptcpd_addr_flags:list(string)' \
'mptcpd_notify_flags:list(string)'
}

start_service() {
local mptcpd_enable mptcp_pm_type mptcpd_path_manager mptcpd_plugins mptcpd_addr_flags mptcpd_notify_flags
validate_section "globals" || {
_err "validation failed"
return 1
}

[ "${mptcp_pm_type}" = "1" ] || return 1
[ "${mptcpd_enable}" = "enable" ] || return 1

[ version_over_5_4 ] || return 1

procd_open_instance

procd_set_param command ${PROG}
[ "${mptcpd_path_manager}" ] && procd_append_param command --path-manager=${mptcpd_path_manager// /,}
[ "${mptcpd_plugins}" ] && procd_append_param command --load-plugins=${mptcpd_plugins// /,}
[ "${mptcpd_add_flags}" ] && procd_append_param command --addr-flags=${mptcpd_addr_flags// /,}
[ "${mptcpd_notify_flags}" ] && procd_append_param command --notify-flags=${mptcpd_notify_flags// /,}

procd_set_param respawn 0 30 5

procd_set_param stdout 1
procd_set_param stderr 1

procd_close_instance

}


service_triggers() {
procd_add_reload_trigger network
}
2 changes: 1 addition & 1 deletion openmptcprouter/files/etc/uci-defaults/1980-omr-firewall
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ done

uci -q batch <<-EOF >/dev/null
set firewall.zone_lan.mtu_fix='1'
set firewall.zone_vpn.mtu_fix='0'
set firewall.zone_vpn.mtu_fix='1'
set firewall.@include[0].reload='1'
commit firewall
EOF
Expand Down