🎁 Sync 2026-08-13 00:16:16

This commit is contained in:
github-actions[bot] committed 2026-08-13 00:16:16 +08:00
1 parent 5c244874df
commit 2a6de1e65f
29 files changed
+1230 -43

No files matched your search

+19 -4
View File
@@ -24,7 +24,7 @@ case $1 in
if [ -f /proc/sys/net/mptcp/mptcp_enabled ]; then
echo " multipath device {on | off | backup }"
else
echo " multipath device {on | off | signal | backup }"
echo " multipath device {on | off | signal | backup } [id]"
fi
echo
echo "show established conections: -c"
@@ -39,6 +39,11 @@ case $1 in
echo "will allow a subflow to be established across this interface, but only be used"
echo "as backup."
echo
echo "Optional trailing [id] (on/signal/backup only): explicit MPTCP endpoint id"
echo "(0-255) to pass to 'ip mptcp endpoint add ... id <id>' instead of letting the"
echo "kernel auto-assign one. Needed for a stable id per WAN across reconnects, e.g."
echo "so a peer (VPS) can pin traffic to this WAN via the subflow's remote_id."
echo
exit 0 ;;
"-c")
if [ -f /proc/net/mptcp_net/mptcp ]; then
@@ -123,6 +128,16 @@ esac
DEVICE="$1"
TYPE="$2"
# Optional explicit MPTCP endpoint id (stable across delete/recreate, unlike
# the kernel's auto-assigned one) so a peer can key on subflow->remote_id.
# Anything that isn't a plain 0-255 integer is ignored (kernel auto-assigns).
ENDPOINT_ID="$3"
case "$ENDPOINT_ID" in
''|*[!0-9]*) ENDPOINT_ID="" ;;
*) [ "$ENDPOINT_ID" -ge 0 ] 2>/dev/null && [ "$ENDPOINT_ID" -le 255 ] 2>/dev/null || ENDPOINT_ID="" ;;
esac
IDOPT=""
[ -n "$ENDPOINT_ID" ] && IDOPT="id $ENDPOINT_ID"
#FLAG_PATH=`find /sys/devices/ -path "*/net/$DEVICE/flags"`
[ -e "/sys/class/net/$DEVICE/" ] || {
@@ -215,7 +230,7 @@ else
done
}
for i in $IP; do
ip mptcp endpoint add $i dev $DEVICE subflow fullmesh
ip mptcp endpoint add $i dev $DEVICE subflow fullmesh $IDOPT
done
exit 0;;
"signal")
@@ -230,7 +245,7 @@ else
}
for i in $IP; do
#ip mptcp endpoint add $i dev $DEVICE signal subflow fullmesh
ip mptcp endpoint add $i dev $DEVICE signal
ip mptcp endpoint add $i dev $DEVICE signal $IDOPT
done
exit 0;;
"backup")
@@ -244,7 +259,7 @@ else
done
}
for i in $IP; do
ip mptcp endpoint add $i dev $DEVICE subflow backup fullmesh
ip mptcp endpoint add $i dev $DEVICE subflow backup fullmesh $IDOPT
done
exit 0;;
"")
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
mptcp_has_master_multipath() {
uci -q show network | grep -q "\.multipath='master'$"
}
mptcp_ensure_ipv6_oif_rule() {
local table="$1"
local iface="$2"
[ -n "$table" ] || return 1
[ -n "$iface" ] || return 1
ip -6 rule show 2>/dev/null | grep -Fq "oif $iface lookup $table" && return 0
ip -6 rule add oif "$iface" table "$table" pref 0
}