1
0
Fork 0
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:
Ycarus 2018-11-28 13:22:13 +01:00
parent 1ba7c1fa52
commit 747251f566

View file

@ -20,11 +20,17 @@ _bypass_ip() {
fi
}
_bypass_domain() {
_bypass_domains() {
local domain
local intf
config_get domain $1 name
config_get intf $1 interface
_bypass_domain $domain $intf
}
_bypass_domain() {
local domain=$1
local intf=$2
[ -z "$intf" ] && intf="all"
if [ -n "$domain" ]; then
@ -144,6 +150,16 @@ _bypass_proto() {
COMMIT
EOF
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() {
@ -236,9 +252,8 @@ start_service() {
config_foreach _bypass_mac macs
config_foreach _bypass_lan_ip lan_ip
uci -q del dhcp.@dnsmasq[0].ipset
config_foreach _bypass_domain domains
config_foreach _bypass_domains domains
uci -q commit dhcp
/etc/init.d/dnsmasq reload
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
@ -301,6 +316,7 @@ start_service() {
config_load omr-bypass
config_foreach _bypass_proto dpis
/etc/init.d/dnsmasq reload
logger -t "omr-bypass" "OMR-ByPass is running"
}