mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-30 05:50:53 +03:00
ipset: clear known DNS caches before DNS test
This commit is contained in:
parent
7f0acb50f1
commit
2d60a37798
42
ipset/def.sh
42
ipset/def.sh
@ -146,11 +146,47 @@ filedigger()
|
|||||||
>&2 echo digging $(wc -l <"$1" | xargs) ipv$2 domains : "$1"
|
>&2 echo digging $(wc -l <"$1" | xargs) ipv$2 domains : "$1"
|
||||||
zzcat "$1" | digger $2 s
|
zzcat "$1" | digger $2 s
|
||||||
}
|
}
|
||||||
|
flush_dns_cache()
|
||||||
|
{
|
||||||
|
echo clearing all known DNS caches
|
||||||
|
|
||||||
|
if exists killall; then
|
||||||
|
killall -HUP dnsmasq 2>/dev/null
|
||||||
|
elif exists pkill; then
|
||||||
|
pkill -HUP ^dnsmasq$
|
||||||
|
else
|
||||||
|
echo no mass killer available ! cant flush dnsmasq
|
||||||
|
fi
|
||||||
|
|
||||||
|
if exists rndc; then
|
||||||
|
rndc flush
|
||||||
|
fi
|
||||||
|
|
||||||
|
if exists systemd-resolve; then
|
||||||
|
systemd-resolve --flush-caches
|
||||||
|
fi
|
||||||
|
|
||||||
|
# MacOS
|
||||||
|
if exists pgrep && pgrep -q ^mDNSResponder$; then
|
||||||
|
killall -HUP mDNSResponder
|
||||||
|
fi
|
||||||
|
}
|
||||||
dnstest()
|
dnstest()
|
||||||
{
|
{
|
||||||
local ip=$(echo w3.org | digger 46)
|
local ip=$(echo w3.org | digger 46)
|
||||||
[ -n "$ip" ]
|
[ -n "$ip" ]
|
||||||
}
|
}
|
||||||
|
dnstest_with_cache_clear()
|
||||||
|
{
|
||||||
|
flush_dns_cache
|
||||||
|
if dnstest ; then
|
||||||
|
echo DNS is working
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo "! DNS is not working"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
cut_local()
|
cut_local()
|
||||||
@ -173,10 +209,7 @@ oom_adjust_high()
|
|||||||
getexclude()
|
getexclude()
|
||||||
{
|
{
|
||||||
oom_adjust_high
|
oom_adjust_high
|
||||||
dnstest || {
|
dnstest_with_cache_clear || return
|
||||||
echo "! DNS is not working. list processing aborted."
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
[ -f "$ZUSERLIST_EXCLUDE" ] && {
|
[ -f "$ZUSERLIST_EXCLUDE" ] && {
|
||||||
[ "$DISABLE_IPV4" != "1" ] && filedigger "$ZUSERLIST_EXCLUDE" 4 | sort -u > "$ZIPLIST_EXCLUDE"
|
[ "$DISABLE_IPV4" != "1" ] && filedigger "$ZUSERLIST_EXCLUDE" 4 | sort -u > "$ZIPLIST_EXCLUDE"
|
||||||
[ "$DISABLE_IPV6" != "1" ] && filedigger "$ZUSERLIST_EXCLUDE" 6 | sort -u > "$ZIPLIST_EXCLUDE6"
|
[ "$DISABLE_IPV6" != "1" ] && filedigger "$ZUSERLIST_EXCLUDE" 6 | sort -u > "$ZIPLIST_EXCLUDE6"
|
||||||
@ -209,3 +242,4 @@ hup_zapret_daemons()
|
|||||||
echo no mass killer available ! cant HUP zapret daemons
|
echo no mass killer available ! cant HUP zapret daemons
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user