Skip to content

Commit 7aed25a

Browse files
authored
Fix Dns::getAddresses() (librenms#18610)
Did not properly check for IPv6 key
1 parent f1a118c commit 7aed25a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

LibreNMS/Util/Dns.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ public function getAddresses(string $hostname, ?AddressFamily $family = null): a
7979
return [];
8080
}
8181

82-
return array_map(fn ($info) => socket_addrinfo_explain($info)['ai_addr']['sin_addr'], $result);
82+
return array_map(function ($info) {
83+
$explaned = socket_addrinfo_explain($info);
84+
85+
return $explaned['ai_addr']['sin6_addr'] ?? $explaned['ai_addr']['sin_addr'];
86+
}, $result);
8387
}
8488

8589
/**

0 commit comments

Comments
 (0)