mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Fix bypass
This commit is contained in:
parent
1ba7c1fa52
commit
747251f566
1 changed files with 19 additions and 3 deletions
|
@ -20,11 +20,17 @@ _bypass_ip() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_bypass_domain() {
|
_bypass_domains() {
|
||||||
local domain
|
local domain
|
||||||
local intf
|
local intf
|
||||||
config_get domain $1 name
|
config_get domain $1 name
|
||||||
config_get intf $1 interface
|
config_get intf $1 interface
|
||||||
|
_bypass_domain $domain $intf
|
||||||
|
}
|
||||||
|
|
||||||
|
_bypass_domain() {
|
||||||
|
local domain=$1
|
||||||
|
local intf=$2
|
||||||
|
|
||||||
[ -z "$intf" ] && intf="all"
|
[ -z "$intf" ] && intf="all"
|
||||||
if [ -n "$domain" ]; then
|
if [ -n "$domain" ]; then
|
||||||
|
@ -144,6 +150,16 @@ _bypass_proto() {
|
||||||
COMMIT
|
COMMIT
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
# Use dnsmasq ipset to bypass domains of the proto
|
||||||
|
local domains
|
||||||
|
domains="$(cat /proc/net/xt_ndpi/host_proto | grep $proto: | sed -e "s/$proto://" -e 's/*//' -e 's/,/ /g')"
|
||||||
|
if [ -n "$domains" ]; then
|
||||||
|
for domain in $domains; do
|
||||||
|
if [ "$(uci -q show omr-bypass | grep $domain)" = "" ]; then
|
||||||
|
_bypass_domain $domain $intf
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_intf_rule() {
|
_intf_rule() {
|
||||||
|
@ -236,9 +252,8 @@ start_service() {
|
||||||
config_foreach _bypass_mac macs
|
config_foreach _bypass_mac macs
|
||||||
config_foreach _bypass_lan_ip lan_ip
|
config_foreach _bypass_lan_ip lan_ip
|
||||||
uci -q del dhcp.@dnsmasq[0].ipset
|
uci -q del dhcp.@dnsmasq[0].ipset
|
||||||
config_foreach _bypass_domain domains
|
config_foreach _bypass_domains domains
|
||||||
uci -q commit dhcp
|
uci -q commit dhcp
|
||||||
/etc/init.d/dnsmasq reload
|
|
||||||
|
|
||||||
ip rule add prio 1 fwmark 0x539 lookup 991337 > /dev/null 2>&1
|
ip rule add prio 1 fwmark 0x539 lookup 991337 > /dev/null 2>&1
|
||||||
ip -6 rule add prio 1 fwmark 0x6539 lookup 6991337 > /dev/null 2>&1
|
ip -6 rule add prio 1 fwmark 0x6539 lookup 6991337 > /dev/null 2>&1
|
||||||
|
@ -301,6 +316,7 @@ start_service() {
|
||||||
config_load omr-bypass
|
config_load omr-bypass
|
||||||
config_foreach _bypass_proto dpis
|
config_foreach _bypass_proto dpis
|
||||||
|
|
||||||
|
/etc/init.d/dnsmasq reload
|
||||||
logger -t "omr-bypass" "OMR-ByPass is running"
|
logger -t "omr-bypass" "OMR-ByPass is running"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue