Skip to content

Commit

Permalink
fix: Compare existing device ip to host lookup like for like (#6316)
Browse files Browse the repository at this point in the history
  • Loading branch information
laf committed Apr 1, 2017
1 parent ae73109 commit 98e8e7e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions includes/polling/functions.inc.php
Expand Up @@ -209,10 +209,10 @@ function poll_device($device, $options)
echo 'Device ID: ' . $device['device_id'] . PHP_EOL;
echo 'OS: ' . $device['os'];
$ip = dnslookup($device);
$db_ip = inet_pton($ip);

if (!empty($ip) && $ip != inet6_ntop($device['ip'])) {
if (!empty($db_ip) && inet6_ntop($db_ip) != inet6_ntop($device['ip'])) {
log_event('Device IP changed to ' . $ip, $device, 'system', 3);
$db_ip = inet_pton($ip);
dbUpdate(array('ip' => $db_ip), 'devices', 'device_id=?', array($device['device_id']));
}

Expand Down

0 comments on commit 98e8e7e

Please sign in to comment.