mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add bypass destination port
This commit is contained in:
parent
211f059419
commit
4f21b4b7c5
2 changed files with 69 additions and 2 deletions
|
@ -153,6 +153,49 @@ _bypass_lan_ip() {
|
|||
fi
|
||||
}
|
||||
|
||||
_bypass_dest_port() {
|
||||
local ip
|
||||
local intf
|
||||
config_get dport $1 dport
|
||||
config_get proto $1 proto
|
||||
config_get intf $1 interface
|
||||
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)
|
||||
if [ "$intf" = "all" ]; then
|
||||
if [ "$valid_ip4" = "ok" ]; then
|
||||
iptables-restore --wait=60 --noflush <<-EOF
|
||||
*mangle
|
||||
-A omr-bypass --protocol $protocol --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 $protocol --destination-port $dport -j MARK --set-mark 0x6539
|
||||
COMMIT
|
||||
EOF
|
||||
fi
|
||||
else
|
||||
if [ "$valid_ip4" = "ok" ]; then
|
||||
iptables-restore --wait=60 --noflush <<-EOF
|
||||
*mangle
|
||||
-A omr-bypass --protocol $protocol --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 $protocol --destination-port $dport -j MARK --set-mark 0x6539$intfid
|
||||
COMMIT
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_bypass_proto() {
|
||||
local proto
|
||||
local intf
|
||||
|
@ -349,6 +392,7 @@ start_service() {
|
|||
config_foreach _bypass_ip_set ips
|
||||
config_foreach _bypass_mac macs
|
||||
config_foreach _bypass_lan_ip lan_ip
|
||||
config_foreach _bypass_dest_port dest_port
|
||||
config_foreach _bypass_asn asns
|
||||
dnsmasqipset=$(uci -q get dhcp.@dnsmasq[0].ipset | sed 's/ /\n/g' | grep -v dst_bypass)
|
||||
uci -q delete dhcp.@dnsmasq[0].ipset
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue