From 50cd4ed495fa5222c9dbf2b8e0eb290cbbac5cb5 Mon Sep 17 00:00:00 2001 From: laf Date: Mon, 23 Mar 2015 16:14:31 +0000 Subject: [PATCH] Moved the check for $force_add so that we do not suffer icmp and snmp timeouts - thanks f0o --- includes/functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index f7f3f44f9..e3905e311 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -278,7 +278,7 @@ function addHost($host, $snmpver, $port = '161', $transport = 'udp', $quiet = '0 if (!(inet_pton($host))) { // Test reachability - if (isPingable($host) || $force_add == 1) + if ($force_add == 1 || isPingable($host)) { if (empty($snmpver)) { @@ -310,7 +310,7 @@ function addHost($host, $snmpver, $port = '161', $transport = 'udp', $quiet = '0 { $device = deviceArray($host, NULL, $snmpver, $port, $transport, $v3); if($quiet == '0') { print_message("Trying v3 parameters " . $v3['authname'] . "/" . $v3['authlevel'] . " ... "); } - if (isSNMPable($device) || $force_add == 1) + if ($force_add == 1 || isSNMPable($device)) { $snmphost = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB"); if (empty($snmphost) or ($snmphost == $host || $hostshort = $host)) @@ -332,7 +332,7 @@ function addHost($host, $snmpver, $port = '161', $transport = 'udp', $quiet = '0 { $device = deviceArray($host, $community, $snmpver, $port, $transport, NULL); if($quiet == '0') { print_message("Trying community $community ..."); } - if (isSNMPable($device) || $force_add == 1) + if ($force_add == 1 || isSNMPable($device)) { $snmphost = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB"); if (empty($snmphost) || ($snmphost && ($snmphost == $host || $hostshort = $host)))