From 22be274027211b081e376d003ecc95376a11be1f Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Sat, 22 May 2021 08:42:49 +0200 Subject: [PATCH 1/4] Forward port using v2ray doesn't work on range --- .../htdocs/luci-static/resources/view/firewall/forwards.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luci-app-firewall/htdocs/luci-static/resources/view/firewall/forwards.js b/luci-app-firewall/htdocs/luci-static/resources/view/firewall/forwards.js index 6c0c7ae73..b30d57c76 100644 --- a/luci-app-firewall/htdocs/luci-static/resources/view/firewall/forwards.js +++ b/luci-app-firewall/htdocs/luci-static/resources/view/firewall/forwards.js @@ -282,7 +282,7 @@ return view.extend({ fwtool.addLimitBurstOption(s); o = s.taboption('advanced', form.Flag, 'v2ray', _('Use V2Ray'), - _('Forwards ports from server using V2Ray proxy (if enabled) instead of VPN')); + _('Forward a port (not a range) from server using V2Ray proxy (if enabled) instead of VPN')); o.modalonly = true; o.editable = true; o.depends({ src: 'vpn', '!contains': true }); From 77045a786d642f0b401595398bf86717d2c1c413 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Sat, 22 May 2021 08:43:10 +0200 Subject: [PATCH 2/4] Add a -w for v2ray iptables --- v2ray-core/files/etc/init.d/v2ray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2ray-core/files/etc/init.d/v2ray b/v2ray-core/files/etc/init.d/v2ray index 72ca71c15..30ac37ec8 100755 --- a/v2ray-core/files/etc/init.d/v2ray +++ b/v2ray-core/files/etc/init.d/v2ray @@ -2081,7 +2081,7 @@ start_instance() { } rules_exist() { - [ -n "$(iptables -t nat -L -n | grep v2r_)" ] && return 0 + [ -n "$(iptables -w -t nat -L -n | grep v2r_)" ] && return 0 return 1 } From c73fa3a692adb891a619193b7636688120ea268c Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Sat, 22 May 2021 08:43:36 +0200 Subject: [PATCH 3/4] Fix loop detection --- mptcp/files/usr/share/omr/post-tracking.d/post-tracking | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mptcp/files/usr/share/omr/post-tracking.d/post-tracking b/mptcp/files/usr/share/omr/post-tracking.d/post-tracking index bccd15eca..cf6b21703 100755 --- a/mptcp/files/usr/share/omr/post-tracking.d/post-tracking +++ b/mptcp/files/usr/share/omr/post-tracking.d/post-tracking @@ -799,7 +799,7 @@ if [ "$OMR_TRACKER_INTERFACE" = "glorytun" ] || [ "$OMR_TRACKER_INTERFACE" = "om if [ "$(pgrep openmptcprouter-vps)" = "" ]; then /etc/init.d/openmptcprouter-vps restart >/dev/null 2>&1 fi - [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && conntrack -D -p udp + [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && conntrack -D -p udp 2>&1 >/dev/null fi # Set VPN MTU @@ -1138,7 +1138,8 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($( if [ -n "$lanip" ] && [ -n "$masterip" ] && [ -n "$ipaddr" ] && [ "$ipaddr" = "$masterip" ] && [ "$(uci -q get openmptcprouter.settings.disableloopdetection)" != "1" ]; then loop=0 routingloop() { - if [ "$(omr-routing-loop $1 $lanip)" = "detected" ]; then + vpsip="$(uci -q get openmptcprouter.$1.ip)" + if [ -n "$vpsip" ] && [ "$(omr-routing-loop $vpsip $lanip)" = "detected" ]; then loop=1 fi } From b40823e54809d74f5ae9cdcd32d800ab1f44e7b2 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Sat, 22 May 2021 17:29:46 +0200 Subject: [PATCH 4/4] Fix loop detection --- luci-app-openmptcprouter/root/bin/omr-routing-loop | 3 ++- mptcp/files/usr/share/omr/post-tracking.d/post-tracking | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/luci-app-openmptcprouter/root/bin/omr-routing-loop b/luci-app-openmptcprouter/root/bin/omr-routing-loop index 396498470..4cc716602 100755 --- a/luci-app-openmptcprouter/root/bin/omr-routing-loop +++ b/luci-app-openmptcprouter/root/bin/omr-routing-loop @@ -1,8 +1,9 @@ #!/bin/sh VPS=$1 LANIP=$2 +INTF=$3 -if [ -n "$(traceroute -q 1 -i eth1 -w 1 -n -m 5 ${VPS} | grep ${LANIP})" ]; then +if [ -n "$(traceroute -q 1 -i ${INTF} -w 1 -n -m 5 ${VPS} | grep ${LANIP})" ]; then echo "detected" else echo "no loop" diff --git a/mptcp/files/usr/share/omr/post-tracking.d/post-tracking b/mptcp/files/usr/share/omr/post-tracking.d/post-tracking index cf6b21703..bc87d4f55 100755 --- a/mptcp/files/usr/share/omr/post-tracking.d/post-tracking +++ b/mptcp/files/usr/share/omr/post-tracking.d/post-tracking @@ -1139,7 +1139,7 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($( loop=0 routingloop() { vpsip="$(uci -q get openmptcprouter.$1.ip)" - if [ -n "$vpsip" ] && [ "$(omr-routing-loop $vpsip $lanip)" = "detected" ]; then + if [ -n "$vpsip" ] && [ "$(omr-routing-loop $vpsip $lanip $OMR_TRACKER_DEVICE)" = "detected" ]; then loop=1 fi }