1
0
mirror of https://github.com/pi-hole/pi-hole synced 2025-01-22 22:10:56 +00:00

Fix logic. If both v6 and v4 divide by two, else dont.

This commit is contained in:
Adam Warner 2016-11-03 08:01:25 +00:00
parent d7d6d6f991
commit 4300759287

View File

@ -21,12 +21,11 @@ today=$(date "+%b %e")
CalcBlockedDomains() {
if [ -e "${gravity}" ]; then
#Are we IPV6 or IPV4?
if [[ -n "${IPV6_ADDRESS}" ]]; then
#We are IPV6
# if BOTH IPV4 and IPV6 are in use, then we need to divide total domains by 2.
if [[ -n "${IPV4_ADDRESS}" && -n "${IPV6_ADDRESS}" ]]; then
blockedDomainsTotal=$(wc -l /etc/pihole/gravity.list | awk '{print $1/2}')
else
#We are IPV4
# only one is set.
blockedDomainsTotal=$(wc -l /etc/pihole/gravity.list | awk '{print $1}')
fi
else
@ -104,8 +103,6 @@ normalChrono() {
CalcBlockedDomains
echo "Blocking: ${blockedDomainsTotal}"
#below commented line does not add up to todaysQueryCount
#echo "Queries: $todaysQueryCountV4 / $todaysQueryCountV6"
echo "Queries: ${queriesToday}" #same total calculation as dashboard
echo "Pi-holed: ${blockedToday} (${percentBlockedToday}%)"