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:
parent
d628946437
commit
e67d7e2296
1 changed files with 22 additions and 30 deletions
|
@ -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,37 +161,30 @@ _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
|
ip6tables-restore --wait=60 --noflush <<-EOF
|
||||||
elif [ "$valid_ip6" = "ok" ]; then
|
*mangle
|
||||||
ip6tables-restore --wait=60 --noflush <<-EOF
|
-A omr-bypass6 --protocol $proto --destination-port $dport -j MARK --set-mark 0x6539
|
||||||
*mangle
|
COMMIT
|
||||||
-A omr-bypass6 --protocol $proto --destination-port $dport -j MARK --set-mark 0x6539
|
EOF
|
||||||
COMMIT
|
|
||||||
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
|
ip6tables-restore --wait=60 --noflush <<-EOF
|
||||||
elif [ "$valid_ip6" = "ok" ]; then
|
*mangle
|
||||||
ip6tables-restore --wait=60 --noflush <<-EOF
|
-A omr-bypass6 --protocol $proto --destination-port $dport -j MARK --set-mark 0x6539$intfid
|
||||||
*mangle
|
COMMIT
|
||||||
-A omr-bypass6 --protocol $proto --destination-port $dport -j MARK --set-mark 0x6539$intfid
|
EOF
|
||||||
COMMIT
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue