From e67d7e229683d8fb080e3e322524b4c8d4275e14 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Sat, 7 Dec 2019 20:13:54 +0100 Subject: [PATCH] Really fix omr-bypass --- .../root/etc/init.d/omr-bypass | 52 ++++++++----------- 1 file changed, 22 insertions(+), 30 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 a051ef440..24c42097f 100755 --- a/luci-app-omr-bypass/root/etc/init.d/omr-bypass +++ b/luci-app-omr-bypass/root/etc/init.d/omr-bypass @@ -154,7 +154,6 @@ _bypass_lan_ip() { } _bypass_dest_port() { - local ip local intf config_get dport $1 dport config_get proto $1 proto @@ -162,37 +161,30 @@ _bypass_dest_port() { local intfid="$(uci -q get omr-bypass.$intf.id)" [ -z "$intf" ] && intf="all" - [ -z "$ip" ] && return - valid_ip4=$(valid_subnet4 $ip) - valid_ip6=$(valid_subnet6 $ip) + [ -z "$dport" ] && return + [ -z "$proto" ] && return if [ "$intf" = "all" ]; then - if [ "$valid_ip4" = "ok" ]; then - iptables-restore --wait=60 --noflush <<-EOF - *mangle - -A omr-bypass --protocol $proto --destination-port $dport -j MARK --set-mark 0x539 - COMMIT - EOF - elif [ "$valid_ip6" = "ok" ]; then - ip6tables-restore --wait=60 --noflush <<-EOF - *mangle - -A omr-bypass6 --protocol $proto --destination-port $dport -j MARK --set-mark 0x6539 - COMMIT - EOF - fi + iptables-restore --wait=60 --noflush <<-EOF + *mangle + -A omr-bypass --protocol $proto --destination-port $dport -j MARK --set-mark 0x539 + COMMIT + EOF + ip6tables-restore --wait=60 --noflush <<-EOF + *mangle + -A omr-bypass6 --protocol $proto --destination-port $dport -j MARK --set-mark 0x6539 + COMMIT + EOF else - if [ "$valid_ip4" = "ok" ]; then - iptables-restore --wait=60 --noflush <<-EOF - *mangle - -A omr-bypass --protocol $proto --destination-port $dport -j MARK --set-mark 0x539$intfid - COMMIT - EOF - elif [ "$valid_ip6" = "ok" ]; then - ip6tables-restore --wait=60 --noflush <<-EOF - *mangle - -A omr-bypass6 --protocol $proto --destination-port $dport -j MARK --set-mark 0x6539$intfid - COMMIT - EOF - fi + iptables-restore --wait=60 --noflush <<-EOF + *mangle + -A omr-bypass --protocol $proto --destination-port $dport -j MARK --set-mark 0x539$intfid + COMMIT + EOF + ip6tables-restore --wait=60 --noflush <<-EOF + *mangle + -A omr-bypass6 --protocol $proto --destination-port $dport -j MARK --set-mark 0x6539$intfid + COMMIT + EOF fi }