From 3cb050d63c08e5ff887f82e8dcf5b5776b00dd48 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Tue, 11 Aug 2009 16:24:50 +0000 Subject: [PATCH] fixes git-svn-id: http://www.observium.org/svn/observer/trunk@449 61d68cd4-352d-0410-923a-c4978735b2b8 --- cleanup.php | 12 ++++++------ html/pages/ipv4.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cleanup.php b/cleanup.php index bfb678946..b4266540e 100755 --- a/cleanup.php +++ b/cleanup.php @@ -6,19 +6,19 @@ include("config.php"); include("includes/functions.php"); -$query = "SELECT *,A.id as id FROM ipaddr AS A, interfaces as I, devices as D +$query = "SELECT *,A.id as id FROM ipv4_addresses AS A, interfaces as I, devices as D WHERE A.interface_id = I.interface_id AND I.device_id = D.device_id AND D.status = '1'"; $data = mysql_query($query); while($row = mysql_fetch_array($data)) { - $mask = trim(shell_exec($config['ipcalc'] . " ".$row['addr']."/".$row['cidr']." | grep Netmask: | cut -d \" \" -f 4")); - $response = trim(`snmpget -v2c -Osq -c $row[community] $row[hostname]:$row[port] ipAdEntIfIndex.$row[addr] | cut -d " " -f 2`); - $maskcheck = trim(`snmpget -v2c -Osq -c $row[community] $row[hostname]:$row[port] ipAdEntNetMask.$row[addr] | cut -d " " -f 2`); + $mask = trim(shell_exec($config['ipcalc'] . " ".$row['ipv4_address']."/".$row['ipv4_prefixlen']." | grep Netmask: | cut -d \" \" -f 4")); + $response = trim(`snmpget -v2c -Osq -c $row[community] $row[hostname]:$row[port] ipAdEntIfIndex.".$row['ipv4_address']." | cut -d " " -f 2`); + $maskcheck = trim(`snmpget -v2c -Osq -c $row[community] $row[hostname]:$row[port] ipAdEntNetMask.".$row['ipv4_address']." | cut -d " " -f 2`); if($response == $row['ifIndex'] && $mask == $maskcheck) { } else { - mysql_query("delete from ipaddr where id = '$row[id]'"); - echo("Deleted $row[addr] from $row[hostname]\n"); + mysql_query("delete from ipv4_address where id = '".$row['ipv4_address_id']."'"); + echo("Deleted ".$row['ipv4_address']." from $row[hostname]\n"); } } diff --git a/html/pages/ipv4.php b/html/pages/ipv4.php index 426852f26..195be1f66 100644 --- a/html/pages/ipv4.php +++ b/html/pages/ipv4.php @@ -51,7 +51,7 @@ while($interface = mysql_fetch_array($query)) { if($_POST['address']) { list($addy, $mask) = explode("/", $_POST['address']); - if(!$mask) { $mask = "/32"; } + if(!$mask) { $mask = "32"; } if (!match_network($addy . "/" . $mask, $interface['ipv4_address'] )) { $ignore = 1; } }