1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-11-20 07:08:13 +00:00

Handle lack of IPv6 gracefully.

This commit is contained in:
Dan Schaper 2016-09-26 18:27:02 -07:00
parent 7729ddab30
commit c41d543d81

View File

@ -96,8 +96,12 @@ function ipCheck {
echo "::: Writing local IPs to logfile" echo "::: Writing local IPs to logfile"
IPADDR=$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet") print $(i+1) }') IPADDR=$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet") print $(i+1) }')
echo "$IPADDR" >> ${DEBUG_LOG} echo "$IPADDR" >> ${DEBUG_LOG}
IP6ADDR=$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet6") print $(i+1) }') IP6ADDR=$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet6") print $(i+1) }')
if [ -n "$IP6ADDR" ]
then
echo "$IP6ADDR" >> ${DEBUG_LOG} echo "$IP6ADDR" >> ${DEBUG_LOG}
fi
echo >> ${DEBUG_LOG} echo >> ${DEBUG_LOG}
echo "::: Locating default gateway and checking connectivity" echo "::: Locating default gateway and checking connectivity"