mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-02-26 21:18:18 +00:00
Working on ipv6 + ipv4
This commit is contained in:
parent
3d7d7b80f0
commit
acfd56a7b9
3 changed files with 13 additions and 4 deletions
|
@ -201,7 +201,7 @@ fi
|
|||
if [[ -n "${IPv6_address}" ]] ; then
|
||||
IPv6_address=$(echo "${IPv6_address}" | cut -f1 -d"/")
|
||||
fi
|
||||
if [[ -n "${IPv6_address}" ]] ; then
|
||||
if [[ -n "${IPv4_address}" ]] ; then
|
||||
IPv4_address=$(echo "${IPv4_address}" | cut -f1 -d"/")
|
||||
fi
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ fi
|
|||
if [[ -n "${IPv6_address}" ]] ; then
|
||||
IPv6_address=$(echo "${IPv6_address}" | cut -f1 -d"/")
|
||||
fi
|
||||
if [[ -n "${IPv6_address}" ]] ; then
|
||||
if [[ -n "${IPv4_address}" ]] ; then
|
||||
IPv4_address=$(echo "${IPv4_address}" | cut -f1 -d"/")
|
||||
fi
|
||||
|
||||
|
|
13
gravity.sh
13
gravity.sh
|
@ -215,11 +215,11 @@ gravity_hostFormat() {
|
|||
fi
|
||||
# Add hostname and dummy domain to the top of gravity.list to make ping result return a friendlier looking domain! Also allows for an easy way to access the Pi-hole admin console (pi.hole/admin)
|
||||
if [[ -n "${IPv6_address}" ]] ; then
|
||||
echo -e "${IPv6_address} $hostname\n${IPv6_address} pi.hole" > ${piholeDir}/${accretionDisc}
|
||||
echo -e "${IPv6_address} $hostname\n${IPv6_address} pi.hole" >> ${piholeDir}/${accretionDisc}
|
||||
cat ${piholeDir}/${eventHorizon} | awk -v ipv6addr="${IPv6_address}" '{sub(/\r$/,""); print ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc}
|
||||
fi
|
||||
if [[ -n "${IPv4_address}" ]] ; then
|
||||
echo -e "${IPv4_address} $hostname\n${IPv4_address} pi.hole" > ${piholeDir}/${accretionDisc}
|
||||
echo -e "${IPv4_address} $hostname\n${IPv4_address} pi.hole" >> ${piholeDir}/${accretionDisc}
|
||||
cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="${IPv4_address}" '{sub(/\r$/,""); print ipv4addr" "$0}' >> ${piholeDir}/${accretionDisc}
|
||||
fi
|
||||
# Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it
|
||||
|
@ -323,6 +323,15 @@ if [[ -r ${piholeDir}/pihole.conf ]];then
|
|||
echo "::: pihole.conf file no longer supported. Over-rides in this file are ignored."
|
||||
fi
|
||||
|
||||
#remove CIDR from IPs
|
||||
if [[ -n "${IPv6_address}" ]] ; then
|
||||
IPv6_address=$(echo "${IPv6_address}" | cut -f1 -d"/")
|
||||
fi
|
||||
if [[ -n "${IPv4_address}" ]] ; then
|
||||
IPv4_address=$(echo "${IPv4_address}" | cut -f1 -d"/")
|
||||
fi
|
||||
|
||||
|
||||
if [[ ${forceGrav} == true ]]; then
|
||||
echo -n "::: Deleting exising list cache..."
|
||||
for f in ${piholeDir}/list.* ; do
|
||||
|
|
Loading…
Add table
Reference in a new issue