From Subtle Eider, 1 Year ago, written in Plain Text.
Embed
  1. diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php
  2. index 36ba1a0..895a7c6 100644
  3. --- a/includes/polling/functions.inc.php
  4. +++ b/includes/polling/functions.inc.php
  5. @@ -209,10 +209,10 @@ function poll_device($device, $options)
  6.      echo 'Device ID: ' . $device['device_id'] . PHP_EOL;
  7.      echo 'OS: ' . $device['os'];
  8.      $ip = dnslookup($device);
  9. +    $db_ip = inet_pton($ip);
  10.  
  11. -    if (!empty($ip) && $ip != inet6_ntop($device['ip'])) {
  12. +    if (!empty($db_ip) && inet6_ntop($db_ip) != inet6_ntop($device['ip'])) {
  13.          log_event('Device IP changed to ' . $ip, $device, 'system', 3);
  14. -        $db_ip = inet_pton($ip);
  15.          dbUpdate(array('ip' => $db_ip), 'devices', 'device_id=?', array($device['device_id']));
  16.      }
  17.  
  18.