Merge pull request #1151 from pi-hole/fix/CIDR

Include CIDR notation for IPv4 non-natural blocks.
This commit is contained in:
Dan Schaper 2017-01-19 14:02:28 -08:00 committed by GitHub
commit cef0211c00

View file

@ -173,7 +173,8 @@ find_IPv4_information() {
# Find IP used to route to outside world # Find IP used to route to outside world
route=$(ip route get 8.8.8.8) route=$(ip route get 8.8.8.8)
IPv4dev=$(awk '{for (i=1; i<=NF; i++) if ($i~/dev/) print $(i+1)}' <<< "${route}") IPv4dev=$(awk '{for (i=1; i<=NF; i++) if ($i~/dev/) print $(i+1)}' <<< "${route}")
IPV4_ADDRESS=$(awk '{print $7}' <<< "${route}") IPv4bare=$(awk '{print $7}' <<< "${route}")
IPV4_ADDRESS=$(ip -o -f inet addr show | grep "${IPv4bare}" | awk '{print $4}' | awk 'END {print}')
IPv4gw=$(awk '{print $3}' <<< "${route}") IPv4gw=$(awk '{print $3}' <<< "${route}")
} }