mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-07-28 16:14:07 +02:00
Remove duplicated code checking if adlist domain is blocked locally
Signed-off-by: Christian König <github@yubiuser.dev>
This commit is contained in:
parent
248d25b8d0
commit
1432568d17
26
gravity.sh
26
gravity.sh
@ -646,32 +646,6 @@ gravity_DownloadBlocklistFromUrl() {
|
|||||||
str="Status:"
|
str="Status:"
|
||||||
echo -ne " ${INFO} ${str} Pending..."
|
echo -ne " ${INFO} ${str} Pending..."
|
||||||
blocked=false
|
blocked=false
|
||||||
case $(getFTLConfigValue dns.blocking.mode) in
|
|
||||||
"IP-NODATA-AAAA" | "IP")
|
|
||||||
# Get IP address of this domain
|
|
||||||
ip="$(dig "${domain}" +short)"
|
|
||||||
# Check if this IP matches any IP of the system
|
|
||||||
if [[ -n "${ip}" && $(grep -Ec "inet(|6) ${ip}" <<<"$(ip a)") -gt 0 ]]; then
|
|
||||||
blocked=true
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"NXDOMAIN")
|
|
||||||
if [[ $(dig "${domain}" | grep "NXDOMAIN" -c) -ge 1 ]]; then
|
|
||||||
blocked=true
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"NODATA")
|
|
||||||
if [[ $(dig "${domain}" | grep "NOERROR" -c) -ge 1 ]] && [[ -z $(dig +short "${domain}") ]]; then
|
|
||||||
blocked=true
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"NULL" | *)
|
|
||||||
if [[ $(dig "${domain}" +short | grep "0.0.0.0" -c) -ge 1 ]]; then
|
|
||||||
blocked=true
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Check if this domain is blocked by Pi-hole but only if the domain is not a
|
# Check if this domain is blocked by Pi-hole but only if the domain is not a
|
||||||
# local file or empty
|
# local file or empty
|
||||||
if [[ $url != "file"* ]] && [[ -n "${domain}" ]]; then
|
if [[ $url != "file"* ]] && [[ -n "${domain}" ]]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user