mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add src port bypass
This commit is contained in:
parent
76ae9b0608
commit
483e96728b
2 changed files with 64 additions and 0 deletions
|
@ -199,6 +199,46 @@ _bypass_dest_port() {
|
|||
fi
|
||||
}
|
||||
|
||||
_bypass_src_port() {
|
||||
local intf
|
||||
config_get sport $1 sport
|
||||
config_get proto $1 proto
|
||||
config_get intf $1 interface
|
||||
local intfid="$(uci -q get omr-bypass.$intf.id)"
|
||||
|
||||
[ -z "$intf" ] && intf="all"
|
||||
[ -z "$sport" ] && return
|
||||
sport="$(echo $sport | sed 's/-/:/')"
|
||||
[ -z "$proto" ] && return
|
||||
if [ "$intf" = "all" ]; then
|
||||
iptables-restore -w --wait=60 --noflush <<-EOF
|
||||
*mangle
|
||||
-A omr-bypass --protocol $proto --source-port $sport -j MARK --set-mark 0x539
|
||||
COMMIT
|
||||
EOF
|
||||
if [ "$disableipv6" != "1" ]; then
|
||||
ip6tables-restore -w --wait=60 --noflush <<-EOF
|
||||
*mangle
|
||||
-A omr-bypass6 --protocol $proto --source-port $sport -j MARK --set-mark 0x6539
|
||||
COMMIT
|
||||
EOF
|
||||
fi
|
||||
else
|
||||
iptables-restore -w --wait=60 --noflush <<-EOF
|
||||
*mangle
|
||||
-A omr-bypass --protocol $proto --source-port $sport -j MARK --set-mark 0x539$intfid
|
||||
COMMIT
|
||||
EOF
|
||||
if [ "$disableipv6" != "1" ]; then
|
||||
ip6tables-restore -w --wait=60 --noflush <<-EOF
|
||||
*mangle
|
||||
-A omr-bypass6 --protocol $proto --source-port $sport -j MARK --set-mark 0x6539$intfid
|
||||
COMMIT
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_bypass_proto() {
|
||||
local proto
|
||||
local intf
|
||||
|
@ -410,6 +450,7 @@ start_service() {
|
|||
config_foreach _bypass_mac macs
|
||||
config_foreach _bypass_lan_ip lan_ip
|
||||
config_foreach _bypass_dest_port dest_port
|
||||
config_foreach _bypass_src_port src_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