Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pi-hole/pi-hole.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/pihole
diff options
context:
space:
mode:
authorChristian König <ckoenig@posteo.de>2021-12-28 15:39:45 +0300
committerChristian König <ckoenig@posteo.de>2021-12-28 15:42:19 +0300
commitf45248df805c426f9d9e654c0f71eb1fd8b795e8 (patch)
tree7e177f2d3429fd96c38a307379c4b56021fa55a0 /pihole
parent5729f64ddc82d3ef477293c6d404a05d1a2ac82b (diff)
Use FTL's new dns-port API endpoint
Signed-off-by: Christian König <ckoenig@posteo.de>
Diffstat (limited to 'pihole')
-rwxr-xr-xpihole18
1 files changed, 9 insertions, 9 deletions
diff --git a/pihole b/pihole
index 5b062267..d9f8b5fa 100755
--- a/pihole
+++ b/pihole
@@ -312,7 +312,7 @@ analyze_ports() {
}
statusFunc() {
- # Determine if there is pihole-FTL service is listening on any UDP port
+ # Determine if there is pihole-FTL service is listening
local listening pid port
pid="$(getFTLPID)"
@@ -323,21 +323,22 @@ statusFunc() {
esac
return 0
else
- #get the port pihole-FTL is listening on
- port="$(lsof -Pni UDP -p ${pid} -a | grep -m1 : | awk -F ":" '{print $2}')"
+ #get the port pihole-FTL is listening on by using FTL's telnet API
+ port="$(echo ">dns-port >quit" | nc 127.0.0.1 4711)"
listening="$(lsof -Pni:53)"
- if [[ ! -z "$port" ]]; then
- if [[ "${1}" != "web" ]] && [[ "$port" -eq 53 ]]; then
- analyze_ports "${listening}"
- fi
- else
+ if [[ "${port}" == "0" ]]; then
case "${1}" in
"web") echo "-1";;
*) echo -e " ${CROSS} DNS service is NOT listening";;
esac
return 0
+ else
+ if [[ "${1}" != "web" ]] && [[ "$port" -eq 53 ]]; then
+ analyze_ports "${listening}"
+ fi
fi
fi
+
# Determine if Pi-hole's blocking is enabled
if grep -q "BLOCKING_ENABLED=false" /etc/pihole/setupVars.conf; then
# A config is commented out
@@ -361,7 +362,6 @@ statusFunc() {
"${PI_HOLE_BIN_DIR}"/pihole enable
fi
- fi
}
tailFunc() {