mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: Fix for issue #5525
* Update discovery-protocols.inc.php Allow invalid hostnames if discovery by IP is true * Update AUTHORS.md signing * Update AUTHORS.md signing * CDP discovery by IP modification CDP would not discover devices that had invalid DNS value for cdpCacheDeviceId - modified to accept Also exclude adding devices whose hostname matches the IP * Update AUTHORS.md * I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md. I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md.
This commit is contained in:
@@ -168,6 +168,7 @@ LibreNMS contributors:
|
||||
- Jacob <wackychocolatefactory@gmail.com> (wackychocolatefactory)
|
||||
- Patrick Velder <patrick2+librenms@velder.li> (patrick7)
|
||||
- Andrew Wippler <andrew.wippler+librenms@gmail.com> (andrewwippler)
|
||||
- Robert Towster <rnt-github at towster.com> (towster)
|
||||
|
||||
Observium was written by:
|
||||
- Adam Armstrong
|
||||
|
@@ -58,8 +58,15 @@ if ($config['autodiscovery']['xdp'] === true) {
|
||||
d_echo($cdp_if_array);
|
||||
foreach (array_keys($cdp_if_array) as $entry_key) {
|
||||
$cdp = $cdp_if_array[$entry_key];
|
||||
if (is_valid_hostname($cdp['cdpCacheDeviceId'])) {
|
||||
$remote_device_id = dbFetchCell('SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?', array($cdp['cdpCacheDeviceId'], $cdp['cdpCacheDeviceId']));
|
||||
if (is_valid_hostname($cdp['cdpCacheDeviceId']) || ($config['discovery_by_ip'] == true)) {
|
||||
$ip_arr = explode(" ", $cdp['cdpCacheAddress']);
|
||||
$a = hexdec($ip_arr[0]);
|
||||
$b = hexdec($ip_arr[1]);
|
||||
$c = hexdec($ip_arr[2]);
|
||||
$d = hexdec($ip_arr[3]);
|
||||
|
||||
$cdp_ip = "$a.$b.$c.$d";
|
||||
$remote_device_id = dbFetchCell('SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ? OR `hostname` = ?', array($cdp['cdpCacheDeviceId'], $cdp['cdpCacheDeviceId'], $cdp_ip));
|
||||
|
||||
if (!$remote_device_id) {
|
||||
$skip_discovery = false;
|
||||
@@ -77,15 +84,6 @@ if ($config['autodiscovery']['xdp'] === true) {
|
||||
if ($config['discovery_by_ip'] !== true) {
|
||||
$remote_device_id = discover_new_device($cdp['cdpCacheDeviceId'], $device, 'CDP', $interface);
|
||||
} else {
|
||||
$ip_arr = explode(" ", $cdp['cdpCacheAddress']);
|
||||
|
||||
$a = hexdec($ip_arr[0]);
|
||||
$b = hexdec($ip_arr[1]);
|
||||
$c = hexdec($ip_arr[2]);
|
||||
$d = hexdec($ip_arr[3]);
|
||||
|
||||
$cdp_ip = "$a.$b.$c.$d";
|
||||
|
||||
$remote_device_id = discover_new_device($cdp_ip, $device, 'CDP', $interface);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user