From d01948583635a2fcfb0e5060e6fba75a66eaca8a Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Tue, 5 Sep 2023 10:10:01 +0200 Subject: [PATCH 1/3] Remove if* interface in MPTCP --- mptcp/files/usr/bin/multipath | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mptcp/files/usr/bin/multipath b/mptcp/files/usr/bin/multipath index 3609eaf51..d0f1b4962 100755 --- a/mptcp/files/usr/bin/multipath +++ b/mptcp/files/usr/bin/multipath @@ -131,6 +131,14 @@ if [ -f /proc/sys/net/mptcp/mptcp_enabled ]; then printf "0x%02x" $(($(($IFF^$(($IFF&$IFF_MASK))))|$FLAG)) > $FLAG_PATH else + # Remove not needed if* interfaces in MPTCP + oldintfs=$(ip mptcp endpoint show | grep "dev eth" | awk '{ print $3 }') + [ -n "$oldintfs" ] && { + for oldintf in $oldintfs; do + ip mptcp endpoint delete id $oldintf 2>&1 >/dev/null + done + } + ID=$(ip mptcp endpoint show | grep -m 1 "dev $DEVICE" | awk '{print $3}') IFF=$(ip mptcp endpoint show | grep -m 1 "dev $DEVICE" | awk '{print $4}') IP=$(ip a show $DEVICE | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p') From 113274239af440de4d9c9d50b0bc2c70fa36fa3f Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Tue, 5 Sep 2023 10:11:21 +0200 Subject: [PATCH 2/3] Do more test before changing MTU --- .../usr/share/omr/post-tracking.d/020-status | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/mptcp/files/usr/share/omr/post-tracking.d/020-status b/mptcp/files/usr/share/omr/post-tracking.d/020-status index 87f06001c..3d3f28e35 100755 --- a/mptcp/files/usr/share/omr/post-tracking.d/020-status +++ b/mptcp/files/usr/share/omr/post-tracking.d/020-status @@ -129,15 +129,21 @@ if [ -n "$OMR_TRACKER_INTERFACE" ] && ([ "$(uci -q get openmptcprouter.$OMR_TRAC elif [ -n "$OMR_TRACKER_DEVICE_IP" ]; then [ -n "$serverip" ] && [ "$serverip" != "127.0.0.1" ] && { local mtu=$(omr-mtu $OMR_TRACKER_DEVICE_IP $serverip) - [ -n "$mtu" ] && { - uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mtu=$mtu - ip link set dev $OMR_TRACKER_DEVICE mtu $mtu > /dev/null 2>&1 + [ -n "$mtu" ] && [ "$mtu" != "$(ip --json link show dev $OMR_TRACKER_DEVICE | jsonfilter -e '@[0].mtu' | tr -d '\n')" ] && { + mtu=$(omr-mtu $OMR_TRACKER_DEVICE_IP $serverip) + [ -n "$mtu" ] && [ "$mtu" != "$(ip --json link show dev $OMR_TRACKER_DEVICE | jsonfilter -e '@[0].mtu' | tr -d '\n')" ] && { + uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mtu=$mtu + ip link set dev $OMR_TRACKER_DEVICE mtu $mtu > /dev/null 2>&1 + } } } || { local mtu=$(omr-mtu $OMR_TRACKER_DEVICE_IP 1.1.1.1) - [ -n "$mtu" ] && { - uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mtu=$mtu - ip link set dev $OMR_TRACKER_DEVICE mtu $mtu > /dev/null 2>&1 + [ -n "$mtu" ] && [ "$mtu" != "$(ip --json link show dev $OMR_TRACKER_DEVICE | jsonfilter -e '@[0].mtu' | tr -d '\n')" ] && { + mtu=$(omr-mtu $OMR_TRACKER_DEVICE_IP $serverip) + [ -n "$mtu" ] && [ "$mtu" != "$(ip --json link show dev $OMR_TRACKER_DEVICE | jsonfilter -e '@[0].mtu' | tr -d '\n')" ] && { + uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mtu=$mtu + ip link set dev $OMR_TRACKER_DEVICE mtu $mtu > /dev/null 2>&1 + } } } fi From c67d378688d1ca86095f014f0ddfef7245039ca1 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Tue, 5 Sep 2023 10:12:28 +0200 Subject: [PATCH 3/3] Fix some log issues with V2Ray --- v2ray-core/files/etc/init.d/v2ray | 2 +- v2ray-core/files/usr/bin/v2ray-rules6 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/v2ray-core/files/etc/init.d/v2ray b/v2ray-core/files/etc/init.d/v2ray index 6d3bc4095..1c122c897 100755 --- a/v2ray-core/files/etc/init.d/v2ray +++ b/v2ray-core/files/etc/init.d/v2ray @@ -450,7 +450,7 @@ add_v2ray_redirect_rules() { commandline="-l ${port} -s $OUTBOUND_SERVERS_V4 --rule-name def --src-default forward --dst-default forward --local-default forward" [ "$(uci -q get v2ray.main_transparent_proxy.redirect_udp)" = "1" ] && ([ "$(uci -q get v2ray.omrout.protocol)" = "vless" ] || [ "$(uci -q get v2ray.omrout.protocol)" = "vmess" ]) && commandline="$commandline -L ${port}" v2ray-rules $commandline - [ "$(uci -q get v2ray.main.inbounds | grep omr6)" != "" ] && { + [ "$(uci -q get v2ray.main.inbounds | grep omr6)" != "" ] && [ -n "$OUTBOUND_SERVERS_V6" ] && { v2ray-rules6 -f commandline="-l $((port+1)) -L $((port+1)) -s $OUTBOUND_SERVERS_V6 --rule-name def --src-default forward --dst-default forward --local-default forward" [ "$(uci -q get v2ray.main_transparent_proxy.redirect_udp)" = "1" ] && ([ "$(uci -q get v2ray.omrout.protocol)" = "vless" ] || [ "$(uci -q get v2ray.omrout.protocol)" = "vmess" ]) && commandline="$commandline -L ${port+1}" diff --git a/v2ray-core/files/usr/bin/v2ray-rules6 b/v2ray-core/files/usr/bin/v2ray-rules6 index 0f9cfeb35..2a96bdf94 100755 --- a/v2ray-core/files/usr/bin/v2ray-rules6 +++ b/v2ray-core/files/usr/bin/v2ray-rules6 @@ -52,7 +52,7 @@ Usage: v2ray-rules6 [options] --local-default Default action for local out TCP traffic -The following ipsets will be created by ss-rules. They are also intended to be +The following ipsets will be created by v2ray-rules. They are also intended to be populated by other programs like dnsmasq with ipset support v2ray_rules6_src_bypass @@ -73,7 +73,7 @@ o_dst_default=bypass o_local_default=bypass __errmsg() { - echo "ss-rules6: $*" >&2 + echo "v2ray-rules6: $*" >&2 } v2ray_rules6_parse_args() {