Skip to content

Commit a2655ee

Browse files
author
Kristan Kenney
authored
Merge pull request hestiacp#924 from Lupul/fix-200712
Fix: cleanup rdns value when dig fails to resolve (network error)
2 parents 80478e5 + 9714161 commit a2655ee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

func/ip.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ is_ip_rdns_valid() {
3131
local awk_ip=$(echo $network_ip | sed 's|\.|/\&\&/|g')
3232
local rev_awk_ip=$(echo $awk_ip | rev)
3333

34-
[ -z "$rdns" ] && local rdns=$(dig +short -x $ip | head -n 1 | sed 's/.$//')
34+
if [ -z "$rdns" ]; then
35+
local rdns=$(dig +short -x "$ip" | head -n 1 | sed 's/.$//') || unset rdns
36+
fi
3537

3638
if [ ! -z "$rdns" ] && [ ! $(echo $rdns | awk "/$awk_ip/ || /$rev_awk_ip/") ]; then
3739
echo $rdns

0 commit comments

Comments
 (0)