Skip to content

Commit

Permalink
Fix issue in healthcheck.sh for IPv6 addresses (#56)
Browse files Browse the repository at this point in the history
* Fix issue in healthcheck.sh for IPv6 addresses

In my case, the `getent hosts` command returns an IPv6 address but `netstat -anp` gives IPv4 addresses, so the last check fails. With this change, the IPv4 address gets resolved correctly.

* explicitly call for IPv4 when using getent
  • Loading branch information
sfo authored May 17, 2024
1 parent 8c07807 commit 09991dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rootfs/scripts/healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ else
fi

# Attempt to resolve BEASTHOST into an IP address
if BEASTIP=$(getent hosts "$BEASTHOST" 2> /dev/null | cut -d ' ' -f 1); then
if BEASTIP=$(getent ahostsv4 "$BEASTHOST" | grep "$BEASTHOST" 2> /dev/null | cut -d ' ' -f 1); then
:
#echo "got host via getent"
elif BEASTIP=$(s6-dnsip4 "$BEASTHOST" 2> /dev/null); then
Expand Down

0 comments on commit 09991dc

Please sign in to comment.