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

Really fix omr-bypass

This commit is contained in:
Ycarus (Yannick Chabanois) 2019-12-07 20:13:54 +01:00
parent d628946437
commit e67d7e2296

View file

@ -154,7 +154,6 @@ _bypass_lan_ip() {
} }
_bypass_dest_port() { _bypass_dest_port() {
local ip
local intf local intf
config_get dport $1 dport config_get dport $1 dport
config_get proto $1 proto config_get proto $1 proto
@ -162,38 +161,31 @@ _bypass_dest_port() {
local intfid="$(uci -q get omr-bypass.$intf.id)" local intfid="$(uci -q get omr-bypass.$intf.id)"
[ -z "$intf" ] && intf="all" [ -z "$intf" ] && intf="all"
[ -z "$ip" ] && return [ -z "$dport" ] && return
valid_ip4=$(valid_subnet4 $ip) [ -z "$proto" ] && return
valid_ip6=$(valid_subnet6 $ip)
if [ "$intf" = "all" ]; then if [ "$intf" = "all" ]; then
if [ "$valid_ip4" = "ok" ]; then
iptables-restore --wait=60 --noflush <<-EOF iptables-restore --wait=60 --noflush <<-EOF
*mangle *mangle
-A omr-bypass --protocol $proto --destination-port $dport -j MARK --set-mark 0x539 -A omr-bypass --protocol $proto --destination-port $dport -j MARK --set-mark 0x539
COMMIT COMMIT
EOF EOF
elif [ "$valid_ip6" = "ok" ]; then
ip6tables-restore --wait=60 --noflush <<-EOF ip6tables-restore --wait=60 --noflush <<-EOF
*mangle *mangle
-A omr-bypass6 --protocol $proto --destination-port $dport -j MARK --set-mark 0x6539 -A omr-bypass6 --protocol $proto --destination-port $dport -j MARK --set-mark 0x6539
COMMIT COMMIT
EOF EOF
fi
else else
if [ "$valid_ip4" = "ok" ]; then
iptables-restore --wait=60 --noflush <<-EOF iptables-restore --wait=60 --noflush <<-EOF
*mangle *mangle
-A omr-bypass --protocol $proto --destination-port $dport -j MARK --set-mark 0x539$intfid -A omr-bypass --protocol $proto --destination-port $dport -j MARK --set-mark 0x539$intfid
COMMIT COMMIT
EOF EOF
elif [ "$valid_ip6" = "ok" ]; then
ip6tables-restore --wait=60 --noflush <<-EOF ip6tables-restore --wait=60 --noflush <<-EOF
*mangle *mangle
-A omr-bypass6 --protocol $proto --destination-port $dport -j MARK --set-mark 0x6539$intfid -A omr-bypass6 --protocol $proto --destination-port $dport -j MARK --set-mark 0x6539$intfid
COMMIT COMMIT
EOF EOF
fi fi
fi
} }
_bypass_proto() { _bypass_proto() {