From 7a9f72c87e99632b9e88ed6a3b5377fe69a5de21 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Mon, 24 Aug 2020 16:43:59 +0200 Subject: [PATCH] Fix omr-bypass --- .../root/etc/init.d/omr-bypass | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/luci-app-omr-bypass/root/etc/init.d/omr-bypass b/luci-app-omr-bypass/root/etc/init.d/omr-bypass index c07e3cfc8..6731d76ca 100755 --- a/luci-app-omr-bypass/root/etc/init.d/omr-bypass +++ b/luci-app-omr-bypass/root/etc/init.d/omr-bypass @@ -290,14 +290,14 @@ _bypass_proto() { _intf_rule_ss_rules() { rule_name=$1 [ "$rule_name" = "ss_rules" ] && rule_name="def" - if [ "$(iptables --wait=40 -t nat -L -n | grep ss_rules_${rule_name}_pre_src)" != "" ] && [ "$(iptables --wait=40 -t nat -L -n | grep omr_dst_bypass_$intf)" = "" ]; then + if [ "$(iptables --wait=40 -t nat -L -n | grep ssr_${rule_name}_pre_src)" != "" ] && [ "$(iptables --wait=40 -t nat -L -n | grep omr_dst_bypass_$intf)" = "" ]; then iptables-restore -w --wait=60 --noflush <<-EOF *nat - -I ss_rules_${rule_name}_dst 1 -m set --match-set omr_dst_bypass_$intf dst -j RETURN - -I ss_rules_${rule_name}_local_out 1 -m set --match-set omr_dst_bypass_$intf dst -j RETURN - -I ss_rules_${rule_name}_local_out 2 -m mark --mark 0x539$count -j RETURN - -I ss_rules_${rule_name}_pre_src 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count - -I ss_rules_${rule_name}_pre_src 2 -m mark --mark 0x539$count -j RETURN + -I ssr_${rule_name}_dst 1 -m set --match-set omr_dst_bypass_$intf dst -j RETURN + -I ssr_${rule_name}_local_out 1 -m set --match-set omr_dst_bypass_$intf dst -j RETURN + -I ssr_${rule_name}_local_out 2 -m mark --mark 0x539$count -j RETURN + -I ssr_${rule_name}_pre_src 1 -m set --match-set omr_dst_bypass_$intf dst -j MARK --set-mark 0x539$count + -I ssr_${rule_name}_pre_src 2 -m mark --mark 0x539$count -j RETURN COMMIT EOF fi @@ -309,14 +309,14 @@ _intf_rule_ss_rules() { COMMIT EOF fi - if [ "$(ip6tables --wait=40 -t nat -L | grep ss_rules6_${rule_name}_pre_src)" != "" ] && [ "$(ip6tables --wait=40 -t nat -L | grep omr6_dst_bypass_$intf)" = "" ]; then + if [ "$(ip6tables --wait=40 -t nat -L | grep ssr6_${rule_name}_pre_src)" != "" ] && [ "$(ip6tables --wait=40 -t nat -L | grep omr6_dst_bypass_$intf)" = "" ]; then ip6tables-restore -w --wait=60 --noflush <<-EOF *nat - -I ss_rules6_${rule_name}_dst 1 -m set --match-set omr6_dst_bypass_$intf dst -j RETURN - -I ss_rules6_${rule_name}_local_out 1 -m set --match-set omr6_dst_bypass_$intf dst -j RETURN - -I ss_rules6_${rule_name}_local_out 2 -m mark --mark 0x6539$count -j RETURN - -I ss_rules6_${rule_name}_pre_src 1 -m set --match-set omr6_dst_bypass_$intf dst -j MARK --set-mark 0x6539$count - -I ss_rules6_${rule_name}_pre_src 2 -m mark --mark 0x6539$count -j RETURN + -I ssr6_${rule_name}_dst 1 -m set --match-set omr6_dst_bypass_$intf dst -j RETURN + -I ssr6_${rule_name}_local_out 1 -m set --match-set omr6_dst_bypass_$intf dst -j RETURN + -I ssr6_${rule_name}_local_out 2 -m mark --mark 0x6539$count -j RETURN + -I ssr6_${rule_name}_pre_src 1 -m set --match-set omr6_dst_bypass_$intf dst -j MARK --set-mark 0x6539$count + -I ssr6_${rule_name}_pre_src 2 -m mark --mark 0x6539$count -j RETURN COMMIT EOF fi @@ -412,14 +412,14 @@ _bypass_omr_server() { _ss_rules_config() { rule_name=$1 [ "$rule_name" = "ss_rules" ] && rule_name="def" - if [ "$(iptables --wait=40 -t nat -L -n | grep ss_rules_${rule_name}_pre_src)" != "" ] && [ "$(iptables --wait=40 -t nat -L -n | grep omr_dst_bypass_all)" = "" ]; then + if [ "$(iptables --wait=40 -t nat -L -n | grep ssr_${rule_name}_pre_src)" != "" ] && [ "$(iptables --wait=40 -t nat -L -n | grep omr_dst_bypass_all)" = "" ]; then iptables-restore -w --wait=60 --noflush <<-EOF *nat - -I ss_rules_${rule_name}_dst 1 -m set --match-set omr_dst_bypass_all dst -j RETURN - -I ss_rules_${rule_name}_local_out 1 -m set --match-set omr_dst_bypass_all dst -j RETURN - -I ss_rules_${rule_name}_local_out 2 -m mark --mark 0x539 -j RETURN - -I ss_rules_${rule_name}_pre_src 1 -m set --match-set omr_dst_bypass_all dst -j MARK --set-mark 0x539 - -I ss_rules_${rule_name}_pre_src 2 -m mark --mark 0x539 -j RETURN + -I ssr_${rule_name}_dst 1 -m set --match-set omr_dst_bypass_all dst -j RETURN + -I ssr_${rule_name}_local_out 1 -m set --match-set omr_dst_bypass_all dst -j RETURN + -I ssr_${rule_name}_local_out 2 -m mark --mark 0x539 -j RETURN + -I ssr_${rule_name}_pre_src 1 -m set --match-set omr_dst_bypass_all dst -j MARK --set-mark 0x539 + -I ssr_${rule_name}_pre_src 2 -m mark --mark 0x539 -j RETURN COMMIT EOF fi @@ -431,14 +431,14 @@ _ss_rules_config() { COMMIT EOF fi - if [ "$(ip6tables --wait=40 -t nat -L | grep ss_rules6_${rule_name}_pre_src)" != "" ] && [ "$(ip6tables --wait=40 -t nat -L | grep omr6_dst_bypass_all)" = "" ]; then + if [ "$(ip6tables --wait=40 -t nat -L | grep ssr6_${rule_name}_pre_src)" != "" ] && [ "$(ip6tables --wait=40 -t nat -L | grep omr6_dst_bypass_all)" = "" ]; then ip6tables-restore -w --wait=60 --noflush <<-EOF *nat - -I ss_rules6_${rule_name}_dst 1 -m set --match-set omr6_dst_bypass_all dst -j RETURN - -I ss_rules6_${rule_name}_local_out 1 -m set --match-set omr6_dst_bypass_all dst -j RETURN - -I ss_rules6_${rule_name}_local_out 2 -m mark --mark 0x6539 -j RETURN - -I ss_rules6_${rule_name}_pre_src 1 -m set --match-set omr6_dst_bypass_all dst -j MARK --set-mark 0x6539 - -I ss_rules6_${rule_name}_pre_src 2 -m mark --mark 0x6539 -j RETURN + -I ssr6_${rule_name}_dst 1 -m set --match-set omr6_dst_bypass_all dst -j RETURN + -I ssr6_${rule_name}_local_out 1 -m set --match-set omr6_dst_bypass_all dst -j RETURN + -I ssr6_${rule_name}_local_out 2 -m mark --mark 0x6539 -j RETURN + -I ssr6_${rule_name}_pre_src 1 -m set --match-set omr6_dst_bypass_all dst -j MARK --set-mark 0x6539 + -I ssr6_${rule_name}_pre_src 2 -m mark --mark 0x6539 -j RETURN COMMIT EOF fi