mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Only check IPv6 if system is enabled.
This commit is contained in:
parent
98db002770
commit
fc360abe43
1 changed files with 38 additions and 21 deletions
|
@ -26,6 +26,9 @@ ADLISTSFILE="/etc/pihole/adlists.list"
|
|||
PIHOLELOG="/var/log/pihole.log"
|
||||
WHITELISTMATCHES="/tmp/whitelistmatches.list"
|
||||
|
||||
# Default to no IPv6, will check and enable if needed.
|
||||
IPV6=ENABLED=false
|
||||
|
||||
# Header info and introduction
|
||||
cat << EOM
|
||||
::: Beginning Pi-hole debug at $(date)!
|
||||
|
@ -105,22 +108,30 @@ distro_check() {
|
|||
echo ":::"
|
||||
}
|
||||
|
||||
ipv6_check() {
|
||||
# Check if system is IPv6 enabled, for use in other functions
|
||||
if [[ -a /proc/net/if_inet6 ]]; then
|
||||
IPV6_ENABLED=true
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
ip_check() {
|
||||
header_write "IP Address Information"
|
||||
# Get the current interface for Internet traffic
|
||||
local IPv6_temp_interface=$(ip -6 r | grep default | cut -d ' ' -f 5)
|
||||
|
||||
# Check if IPv6 enabled
|
||||
local IPv6_interface
|
||||
ipv6_check && IPv6_interface=${piholeInterface:-$(ip -6 r | grep default | cut -d ' ' -f 5)}
|
||||
# If declared in setupVars.conf use it, otherwise defer to default
|
||||
# http://stackoverflow.com/questions/2013547/assigning-default-values-to-shell-variables-with-a-single-command-in-bash
|
||||
local IPv6_interface=${piholeInterface:-$IPv6_temp_interface}
|
||||
|
||||
echo "::: Collecting local IP info."
|
||||
local IPv4_addr_list="$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet") print $(i+1) }')" \
|
||||
&& (log_write "${IPv4_addr_list}" && echo "::: IPv4 addresses located") || log_echo "No IPv4 addresses found."
|
||||
|
||||
local IPv6_addr_list="$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet6") print $(i+1) }')" \
|
||||
&& (log_write "${IPv6_addr_list}" && echo "::: IPv6 addresses located") || log_echo "No IPv6 addresses found."
|
||||
|
||||
|
||||
echo "::: Locating default gateway and checking connectivity"
|
||||
local IPv4_def_gateway=$(ip r | grep default | cut -d ' ' -f 3)
|
||||
if [[ $? = 0 ]]; then
|
||||
|
@ -135,6 +146,11 @@ ip_check() {
|
|||
log_write "${IPv4_inet_check}"
|
||||
fi
|
||||
|
||||
if [[ IPV6_ENABLED ]]; then
|
||||
local IPv6_addr_list="$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet6") print $(i+1) }')" \
|
||||
&& (log_write "${IPv6_addr_list}" && echo "::: IPv6 addresses located") \
|
||||
|| log_echo "No IPv6 addresses found."
|
||||
|
||||
local IPv6_def_gateway=$(ip -6 r | grep default | cut -d ' ' -f 3)
|
||||
if [[ $? = 0 ]]; then
|
||||
echo -n "::: Pinging default IPv6 gateway: "
|
||||
|
@ -151,6 +167,7 @@ ip_check() {
|
|||
log_write "${IPv6_inet_check}"
|
||||
log_write ""
|
||||
echo ":::"
|
||||
fi
|
||||
}
|
||||
|
||||
hostnameCheck() {
|
||||
|
|
Loading…
Reference in a new issue