Fix snmp test for ipv6

Just check that the port is present, not the exact form of the
IP address.
This commit is contained in:
Nikita Popov 2021-07-20 15:00:50 +02:00
parent b420d09f4d
commit c289f5241d

View file

@ -21,7 +21,7 @@ if (ip2long($ip) === FALSE) {
$port = 1161;
$session = new SNMP(SNMP::VERSION_1, "$hostname:$port", $community, $timeout, $retries);
$info = $session->info;
if (strcmp($info["hostname"], "$ip:$port") !== 0) {
if (!str_ends_with($info["hostname"], ":$port")) {
echo "'" . $info["hostname"] . "' != '$ip:$port'\n";
}
var_dump($session->close());