mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-11 23:07:52 +08:00
🔥 Sync 2026-10-24 23:19:23
This commit is contained in:
1 parent
9886197604
commit
37e1475e87
59 files changed
+5167
-1483
No files matched your search
+1
-1
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mptcp
|
||||
PKG_VERSION:=6.1
|
||||
PKG_RELEASE:=28
|
||||
PKG_RELEASE:=29
|
||||
|
||||
PKG_MAINTAINER:=Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
@@ -265,28 +265,43 @@ interface_macaddr_count() {
|
||||
[ "$macaddr" = "$dmacaddr" ] && [ "${intf%.*}" = "$intf" ] && nbmac=$((nbmac+1))
|
||||
}
|
||||
|
||||
# procd reloads this init on every interface event. A "uci commit" writes
|
||||
# the whole pending delta of the config, other processes' staged changes
|
||||
# included (openmptcprouter-vps's uncommitted token went to flash on each
|
||||
# reload), so an option is only set when it differs, and a config is only
|
||||
# committed when this run changed it.
|
||||
_mptcp_uci_set() {
|
||||
[ "$(uci -q get "$1")" = "$2" ] && return 0
|
||||
uci -q set "$1=$2"
|
||||
_mptcp_uci_changed="$_mptcp_uci_changed ${1%%.*}"
|
||||
}
|
||||
|
||||
_mptcp_uci_delete() {
|
||||
uci -q get "$1" >/dev/null || return 0
|
||||
uci -q delete "$1"
|
||||
_mptcp_uci_changed="$_mptcp_uci_changed ${1%%.*}"
|
||||
}
|
||||
|
||||
_mptcp_uci_commit() {
|
||||
case " $_mptcp_uci_changed " in
|
||||
*" $1 "*) uci -q commit "$1" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
interface_max_metric() {
|
||||
local config="$1"
|
||||
case "$1" in
|
||||
omrvpn)
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set network.${config}.metric=1500
|
||||
set network.${config}.ip4table=1500
|
||||
set network.${config}.ip6table=61500
|
||||
commit network
|
||||
set openmptcprouter.${config}.metric=1500
|
||||
commit openmptcprouter
|
||||
EOF
|
||||
_mptcp_uci_set network.${config}.metric 1500
|
||||
_mptcp_uci_set network.${config}.ip4table 1500
|
||||
_mptcp_uci_set network.${config}.ip6table 61500
|
||||
_mptcp_uci_set openmptcprouter.${config}.metric 1500
|
||||
;;
|
||||
omr6in4)
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set network.${config}.metric=1201
|
||||
set network.${config}.ip4table=1201
|
||||
set network.${config}.ip6table=61201
|
||||
commit network
|
||||
set openmptcprouter.${config}.metric=1201
|
||||
commit openmptcprouter
|
||||
EOF
|
||||
_mptcp_uci_set network.${config}.metric 1201
|
||||
_mptcp_uci_set network.${config}.ip4table 1201
|
||||
_mptcp_uci_set network.${config}.ip6table 61201
|
||||
_mptcp_uci_set openmptcprouter.${config}.metric 1201
|
||||
;;
|
||||
lan)
|
||||
# only when needed: this runs on every reload, sed -i writes flash
|
||||
@@ -477,10 +492,10 @@ interface_multipath_settings() {
|
||||
# metric="9998"
|
||||
fi
|
||||
config_set "$config" metric $metric
|
||||
uci -q set network.${config}.metric=$metric
|
||||
uci -q set network.${config}.ip4table=$metric
|
||||
uci -q set network.${config}.ip6table=6$metric
|
||||
uci -q set openmptcprouter.${config}.metric=$metric
|
||||
_mptcp_uci_set network.${config}.metric "$metric"
|
||||
_mptcp_uci_set network.${config}.ip4table "$metric"
|
||||
_mptcp_uci_set network.${config}.ip6table "6$metric"
|
||||
_mptcp_uci_set openmptcprouter.${config}.metric "$metric"
|
||||
config_get mode "$config" multipath
|
||||
config_get disabled "$config" disabled
|
||||
[ "$disabled" = "1" ] && mode="off"
|
||||
@@ -504,7 +519,7 @@ interface_multipath_settings() {
|
||||
mode="$(uci -q get openmptcprouter.${config}.multipath)"
|
||||
[ -n "$mode" ] && {
|
||||
logger -t "MPTCP" "No multipath setting for $config, restoring $mode from openmptcprouter config"
|
||||
uci -q set network.${config}.multipath="$mode"
|
||||
_mptcp_uci_set network.${config}.multipath "$mode"
|
||||
}
|
||||
}
|
||||
[ "$mode" = "" ] && {
|
||||
@@ -513,8 +528,8 @@ interface_multipath_settings() {
|
||||
[ "$config" = "omr6in4" ] && mode="off"
|
||||
[ "$mode" = "" ] && mode="off"
|
||||
logger -t "MPTCP" "Multipath not defined for $config set to $mode"
|
||||
uci -q set network.${config}.multipath="$mode"
|
||||
uci -q set openmptcprouter.${config}.multipath="$mode"
|
||||
_mptcp_uci_set network.${config}.multipath "$mode"
|
||||
_mptcp_uci_set openmptcprouter.${config}.multipath "$mode"
|
||||
}
|
||||
[ "$mode" != "off" ] && {
|
||||
# LRO, TSO and UFO break MPTCP packets scheduling, always disable them on multipath interfaces
|
||||
@@ -526,9 +541,9 @@ interface_multipath_settings() {
|
||||
[ -n "$mptcpintf" ] && mptcpintf="$mptcpintf $iface"
|
||||
[ -z "$mptcpintf" ] && mptcpintf="$iface"
|
||||
[ -z "$mptcpmintf" ] && mptcpmintf="$config"
|
||||
uci -q set network.${config}.defaultroute=0
|
||||
uci -q set network.${config}.peerdns=0
|
||||
uci -q delete network.${config}.dns
|
||||
_mptcp_uci_set network.${config}.defaultroute 0
|
||||
_mptcp_uci_set network.${config}.peerdns 0
|
||||
_mptcp_uci_delete network.${config}.dns
|
||||
echo '' > /etc/resolv.conf >/dev/null 2>&1
|
||||
}
|
||||
[ "$mode" = "master" ] && {
|
||||
@@ -537,14 +552,14 @@ interface_multipath_settings() {
|
||||
logger -t "MPTCP" "Multipath master already set, disable master for $config"
|
||||
mode="on"
|
||||
config_set "$config" multipath "on"
|
||||
uci -q set network.${config}.multipath="on"
|
||||
uci -q set openmptcprouter.${config}.multipath="on"
|
||||
_mptcp_uci_set network.${config}.multipath "on"
|
||||
_mptcp_uci_set openmptcprouter.${config}.multipath "on"
|
||||
else
|
||||
master="$config"
|
||||
fi
|
||||
}
|
||||
uci -q set openmptcprouter.${config}="interface"
|
||||
uci -q set openmptcprouter.${config}.multipath="$mode"
|
||||
_mptcp_uci_set openmptcprouter.${config} "interface"
|
||||
_mptcp_uci_set openmptcprouter.${config}.multipath "$mode"
|
||||
|
||||
config_get macaddr "$config" macaddr ""
|
||||
[ -n "$macaddr" ] && {
|
||||
@@ -552,7 +567,7 @@ interface_multipath_settings() {
|
||||
config_foreach interface_macaddr_count interface $macaddr
|
||||
[ "$nbmac" != "1" ] && {
|
||||
logger -t "MPTCP" "Duplicate MAC saved, removing"
|
||||
uci -q delete network.${config}.macaddr
|
||||
_mptcp_uci_delete network.${config}.macaddr
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,6 +604,13 @@ interface_multipath_settings() {
|
||||
config_get ipaddr $config ipaddr
|
||||
config_get gateway $config gateway
|
||||
config_get netmask $config netmask
|
||||
# ipaddr can be a list in CIDR notation, with no netmask: network
|
||||
# stayed empty and the WAN got no table route, rule or qdisc
|
||||
ipaddr="${ipaddr%% *}"
|
||||
case "$ipaddr" in */*)
|
||||
[ -z "$netmask" ] && netmask="${ipaddr#*/}"
|
||||
ipaddr="${ipaddr%%/*}"
|
||||
;; esac
|
||||
[ -n "$ipaddr" ] && [ -n "$netmask" ] && netmask=`ipcalc.sh $ipaddr/$netmask | sed -n '/PREFIX=/{;s/.*=//;s/ .*//;p;}'`
|
||||
[ -n "$ipaddr" ] && [ -n "$netmask" ] && network=`ipcalc.sh $ipaddr/$netmask | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'`
|
||||
elif [ "$proto" != "gre" ]; then
|
||||
@@ -970,6 +992,7 @@ start_service() {
|
||||
mptcpmintf=""
|
||||
master=""
|
||||
count=0
|
||||
_mptcp_uci_changed=""
|
||||
config_load openmptcprouter
|
||||
config_foreach interface_max_metric interface
|
||||
|
||||
@@ -1000,13 +1023,13 @@ start_service() {
|
||||
intfmaster="$mptcpmintf"
|
||||
[ "$intfmaster" != "" ] && mptcp_has_master_multipath && {
|
||||
logger -t "MPTCP" "Master multipath interface disabled, setting it to $intfmaster"
|
||||
uci -q set network.${intfmaster}.multipath="master"
|
||||
uci -q set openmptcprouter.${intfmaster}.multipath="master"
|
||||
_mptcp_uci_set network.${intfmaster}.multipath "master"
|
||||
_mptcp_uci_set openmptcprouter.${intfmaster}.multipath "master"
|
||||
}
|
||||
fi
|
||||
fi
|
||||
[ -n "$(uci -q changes network)" ] && uci -q commit network
|
||||
[ -n "$(uci -q changes openmptcprouter)" ] && uci -q commit openmptcprouter
|
||||
_mptcp_uci_commit network
|
||||
_mptcp_uci_commit openmptcprouter
|
||||
case "$board_name" in
|
||||
*raspberry*) case "$board_name" in *4-model-b*|*5*) ;; *)
|
||||
ethtool --offload eth0 rx off tx off > /dev/null 2>&1
|
||||
|
||||
@@ -83,33 +83,27 @@ if [ "$(uci -q get network.globals.congestion)" = "bbr2" ] && [ -z "$(uname -a |
|
||||
commit network
|
||||
EOF
|
||||
fi
|
||||
if [ "$(uci -q get network.globals.mptcp_syn_retries)" = "1" ]; then
|
||||
# The old defaults (syn_retries 1, add_addr_accepted 1) are moved once:
|
||||
# this script runs again on every sysupgrade, and a 1 the user chose
|
||||
# afterwards was reset each time, as were the checksum and the debug level.
|
||||
# mptcp_defaults_version records which of these migrations already ran.
|
||||
if [ "$(uci -q get network.globals.mptcp_defaults_version)" != "1" ]; then
|
||||
if [ "$(uci -q get network.globals.mptcp_syn_retries)" = "1" ]; then
|
||||
uci -q set network.globals.mptcp_syn_retries=4
|
||||
fi
|
||||
if [ "$(uci -q get network.globals.mptcp_add_addr_accepted)" = "1" ]; then
|
||||
uci -q set network.globals.mptcp_add_addr_accepted=8
|
||||
fi
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set network.globals.mptcp_syn_retries=4
|
||||
set network.globals.mptcp_defaults_version=1
|
||||
commit network
|
||||
EOF
|
||||
fi
|
||||
if [ "$(uci -q get network.globals.mptcp_checksum)" != "0" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set network.globals.mptcp_checksum=0
|
||||
commit network
|
||||
EOF
|
||||
fi
|
||||
if [ "$(uci -q get network.globals.mptcp_checksum)" = "enable" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set network.globals.mptcp_checksum=1
|
||||
EOF
|
||||
fi
|
||||
if [ "$(uci -q get network.globals.mptcp_checksum)" = "disable" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set network.globals.mptcp_checksum=0
|
||||
EOF
|
||||
fi
|
||||
if [ "$(uci -q get network.globals.mptcp_debug)" != "0" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set network.globals.mptcp_debug=0
|
||||
EOF
|
||||
fi
|
||||
# enable/disable were written by an older release: the sysctl takes 1/0
|
||||
case "$(uci -q get network.globals.mptcp_checksum)" in
|
||||
enable) uci -q set network.globals.mptcp_checksum=1; uci -q commit network ;;
|
||||
disable) uci -q set network.globals.mptcp_checksum=0; uci -q commit network ;;
|
||||
esac
|
||||
|
||||
if [ "$(uci -q show network.globals | grep mptcp_fullmesh)" = "" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
@@ -127,12 +121,33 @@ if [ "$(uci -q get network.globals.mptcp_subflows)" = "" ]; then
|
||||
commit network
|
||||
EOF
|
||||
fi
|
||||
if [ "$(uci -q get network.globals.mptcp_add_addr_accepted)" = "1" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set network.globals.mptcp_add_addr_accepted=8
|
||||
commit network
|
||||
EOF
|
||||
fi
|
||||
# A multipath_weight out of 1-256 (0, 300, set by hand or by an older
|
||||
# release) failed the datatype of the MPTCP pages and blocked every save
|
||||
# there. Stored as 040-multipath-weight reads it: not a number is unset
|
||||
# (100), leading zeros dropped, 0 is 1, over 256 is 256.
|
||||
_weight_changed=""
|
||||
for _sec in $(uci -q show network | sed -n "s/^network\.\([^.]*\)\.multipath_weight=.*/\1/p"); do
|
||||
_weight="$(uci -q get "network.${_sec}.multipath_weight")"
|
||||
case "$_weight" in
|
||||
''|*[!0-9]*) _new_weight="" ;;
|
||||
*)
|
||||
_new_weight="${_weight#"${_weight%%[!0]*}"}"
|
||||
if [ -z "$_new_weight" ]; then
|
||||
_new_weight=1
|
||||
elif [ "${#_new_weight}" -gt 3 ] || [ "$_new_weight" -gt 256 ]; then
|
||||
_new_weight=256
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
[ "$_new_weight" = "$_weight" ] && continue
|
||||
if [ -z "$_new_weight" ]; then
|
||||
uci -q delete "network.${_sec}.multipath_weight"
|
||||
else
|
||||
uci -q set "network.${_sec}.multipath_weight=${_new_weight}"
|
||||
fi
|
||||
_weight_changed=1
|
||||
done
|
||||
[ -n "$_weight_changed" ] && uci -q commit network
|
||||
|
||||
# The pre-procd config-change registration was dropped from here: OMR images
|
||||
# ship no /etc/config/ucitrack, so it failed silently anyway, and the init
|
||||
|
||||
Reference in new issue
Block a user