mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Store IPv4 networks as network address and fix address search page showing networks not addresses (#10144)
* Store IPv4 networks as network address, not device address * Properly display addresses, not networks on address search page
This commit is contained in:
@@ -17,7 +17,8 @@ foreach ($vrfs_lite_cisco as $vrf) {
|
||||
list($oid,$ifIndex) = explode(' ', $data);
|
||||
$mask = trim(snmp_get($device, "ipAdEntNetMask.$oid", '-Oqv', 'IP-MIB'));
|
||||
$cidr = IPv4::netmask2cidr($mask);
|
||||
$network = "$oid/$cidr";
|
||||
$ipv4 = new IPv4("$oid/$cidr");
|
||||
$network = $ipv4->getNetworkAddress() . '/' . $ipv4->cidr;
|
||||
|
||||
|
||||
if (dbFetchCell('SELECT COUNT(*) FROM `ports` WHERE device_id = ? AND `ifIndex` = ?', array($device['device_id'], $ifIndex)) != '0' && $oid != '0.0.0.0' && $oid != 'ipAdEntIfIndex') {
|
||||
|
||||
@@ -85,11 +85,11 @@ foreach (dbFetchRows($sql, $param) as $interface) {
|
||||
$type = humanmedia($interface['ifType']);
|
||||
|
||||
if ($vars['search_type'] == 'ipv6') {
|
||||
$address = (string)IP::parse($interface['ipv6_network'], true);
|
||||
$address = (string)IP::parse($interface['ipv6_address'], true) . '/' . $interface['ipv6_prefixlen'];
|
||||
} elseif ($vars['search_type'] == 'mac') {
|
||||
$address = formatMac($interface['ifPhysAddress']);
|
||||
} else {
|
||||
$address = (string)IP::parse($interface['ipv4_network'], true);
|
||||
$address = (string)IP::parse($interface['ipv4_address'], true) . '/' . $interface['ipv4_prefixlen'];
|
||||
}
|
||||
|
||||
if ($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
|
||||
|
||||
Reference in New Issue
Block a user