Set up for IP matching in detection.

This commit is contained in:
Dan Schaper 2017-02-16 19:45:44 -08:00
parent 2aa3a109a0
commit 053b38e0bd
No known key found for this signature in database
GPG key ID: 572E999E385B7BFC

View file

@ -189,10 +189,13 @@ ipv6_check() {
ip_check() { ip_check() {
local protocol=${1} local protocol=${1}
local gravity=${2}
local ip_addr_list="$(ip -${protocol} addr show dev ${PIHOLE_INTERFACE} | awk -F ' ' '{ for(i=1;i<=NF;i++) if ($i ~ '/^inet/') print $(i+1) }')" local ip_addr_list="$(ip -${protocol} addr show dev ${PIHOLE_INTERFACE} | awk -F ' ' '{ for(i=1;i<=NF;i++) if ($i ~ '/^inet/') print $(i+1) }')"
if [[ -n ${ip_addr_list} ]]; then if [[ -n ${ip_addr_list} ]]; then
log_write "IPv${protocol} on ${PIHOLE_INTERFACE}" log_write "IPv${protocol} on ${PIHOLE_INTERFACE}"
log_write "Gravity configured for: ${2:-NOT CONFIGURED}"
log_write "----"
log_write "${ip_addr_list}" log_write "${ip_addr_list}"
echo "::: IPv${protocol} addresses located on ${PIHOLE_INTERFACE}" echo "::: IPv${protocol} addresses located on ${PIHOLE_INTERFACE}"
ip_ping_check ${protocol} ip_ping_check ${protocol}
@ -204,7 +207,6 @@ ip_check() {
} }
ip_ping_check() { ip_ping_check() {
local protocol=${1} local protocol=${1}
local cmd local cmd
@ -234,19 +236,12 @@ ip_ping_check() {
echo "Query responded." echo "Query responded."
log_write "${ping_inet}" log_write "${ping_inet}"
fi fi
else
log_echo " No gateway detected."
fi fi
return 0 return 0
} }
ip_check_wrapper() {
header_write "IP Address Information"
if ipv6_check; then
ip_check "6"
fi
ip_check "4"
}
port_check() { port_check() {
local lsof_value local lsof_value
@ -357,7 +352,8 @@ distro_check || echo "Distro Check soft fail"
# Gather processor type # Gather processor type
processor_check || echo "Processor Check soft fail" processor_check || echo "Processor Check soft fail"
ip_check_wrapper ip_check 6 ${IPV6_ADDRESS}
ip_check 4 ${IPV4_ADDRESS}
daemon_check lighttpd http daemon_check lighttpd http
daemon_check dnsmasq domain daemon_check dnsmasq domain