1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00

Merge pull request #166 from Ysurac/develop

sync
This commit is contained in:
suyuan 2021-08-10 22:25:42 +08:00 committed by GitHub
commit f655a4583f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 12 deletions

View file

@ -8,7 +8,7 @@ config glorytun-udp 'vpn'
option localip '10.255.254.2'
option remoteip '10.255.254.1'
option mode 'to'
option mode kxtimeout '7d'
option mode timetolerance '10m'
option mode keepalive '25s'
option mode rateauto '0'
option kxtimeout '7d'
option timetolerance '10m'
option keepalive '25s'
option rateauto '0'

View file

@ -117,21 +117,22 @@ if [ -f /proc/sys/net/mptcp/mptcp_enabled ]; then
else
ID=$(ip mptcp endpoint show | grep "dev $DEVICE" | awk '{print $3}')
IFF=$(ip mptcp endpoint show | grep "dev $DEVICE" | awk '{print $4}')
IP=$(ifconfig $DEVICE | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
case $TYPE in
"off")
[ -n "$ID" ] && ip mptcp endpoint delete id $ID
[ -n "$ID" ] && ip mptcp endpoint delete id $ID 2>&1 >/dev/null
exit 0;;
"on")
[ -n "$ID" ] && ip mptcp endpoint delete id $ID
ip mptcp endpoint add $IP dev $DEVICE subflow
[ -n "$ID" ] && ip mptcp endpoint delete id $ID 2>&1 >/dev/null
ip mptcp endpoint add $IP dev $DEVICE subflow fullmesh
exit 0;;
"signal")
[ -n "$ID" ] && ip mptcp endpoint delete id $ID
ip mptcp endpoint add $IP dev $DEVICE signal subflow
[ -n "$ID" ] && ip mptcp endpoint delete id $ID 2>&1 >/dev/null
ip mptcp endpoint add $IP dev $DEVICE signal subflow fullmesh
exit 0;;
"backup")
[ -n "$ID" ] && ip mptcp endpoint delete id $ID
ip mptcp endpoint add $IP dev $DEVICE backup
[ -n "$ID" ] && ip mptcp endpoint delete id $ID 2>&1 >/dev/null
ip mptcp endpoint add $IP dev $DEVICE backup fullmesh
exit 0;;
"")
case "$IFF" in
@ -139,6 +140,7 @@ else
"subflow") echo $DEVICE is in default mode;;
"backup") echo $DEVICE is in backup mode;;
"signal") echo $DEVICE is in signal mode;;
"fullmesh") echo $DEVICE is in fullmesh mode;;
*) echo "$DEVICE Unkown state!" && exit 1;;
esac
exit 0;;

View file

@ -1101,7 +1101,7 @@ if [ "$multipath_config" = "on" ] || [ "$multipath_config" = "backup" ]; then
fi
[ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" != "1" ] && {
[ "$multipath_status" = "$multipath_config" ] || {
if [ "$(sysctl -n net.mptcp.mptcp_enabled | tr -d '\n')" = "1" ]; then
if [ "$(sysctl -qn net.mptcp.mptcp_enabled | tr -d '\n')" = "1" ] || [ "$(sysctl -qn net.mptcp.enabled | tr -d '\n')" = "1" ]; then
_log "Multipath $OMR_TRACKER_DEVICE switched to $multipath_config"
multipath "$OMR_TRACKER_DEVICE" "$multipath_config"
fi