From ad024d9055558fbeb2bafe8850bffd5d1c90f203 Mon Sep 17 00:00:00 2001 From: laf Date: Sat, 4 Apr 2015 11:42:30 +0100 Subject: [PATCH] Updated search tables for ipv4,ipv6,mac and arp --- html/includes/table/address-search.inc.php | 100 ++++++++++ html/includes/table/arp-search.inc.php | 78 ++++++++ html/pages/search/arp.inc.php | 204 ++++++++------------- html/pages/search/ipv4.inc.php | 162 ++++++++-------- html/pages/search/ipv6.inc.php | 163 ++++++++-------- html/pages/search/mac.inc.php | 165 +++++++++-------- 6 files changed, 487 insertions(+), 385 deletions(-) create mode 100644 html/includes/table/address-search.inc.php create mode 100644 html/includes/table/arp-search.inc.php diff --git a/html/includes/table/address-search.inc.php b/html/includes/table/address-search.inc.php new file mode 100644 index 0000000000..9171c398a3 --- /dev/null +++ b/html/includes/table/address-search.inc.php @@ -0,0 +1,100 @@ + 0 || $interface['out_errors'] > 0) { + $error_img = generate_port_link($interface,"Interface Errors",errors); + } else { + $error_img = ""; + } + if (port_permitted($interface['port_id'])) { + $interface = ifLabel ($interface, $interface); + $response[] = array('hostname'=>generate_device_link($interface), + 'interface'=>generate_port_link($interface) . ' ' . $error_img, + 'address'=>$address, + 'description'=>$interface['ifAlias']); + } + } + unset($ignore); +} + +$output = array('current'=>$current,'rowCount'=>$rowCount,'rows'=>$response,'total'=>$total); +echo _json_encode($output); diff --git a/html/includes/table/arp-search.inc.php b/html/includes/table/arp-search.inc.php new file mode 100644 index 0000000000..36ab2e19b1 --- /dev/null +++ b/html/includes/table/arp-search.inc.php @@ -0,0 +1,78 @@ + 0 || $entry['ifOutErrors'] > 0) { + $error_img = generate_port_link($entry,"Interface Errors",errors); + } else { + $error_img = ""; + } + + $arp_host = dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id", array($entry['ipv4_address'])); + if ($arp_host) { + $arp_name = generate_device_link($arp_host); + } else { + unset($arp_name); + } + if ($arp_host) { + $arp_if = generate_port_link($arp_host); + } else { + unset($arp_if); + } + if ($arp_host['device_id'] == $entry['device_id']) { + $arp_name = "Localhost"; + } + if ($arp_host['port_id'] == $entry['port_id']) { + $arp_if = "Local port"; + } + $response[] = array('mac_address'=>formatMac($entry['mac_address']), + 'ipv4_address'=>$entry['ipv4_address'], + 'hostname'=>generate_device_link($entry), + 'interface'=>generate_port_link($entry, makeshortif(fixifname($entry['ifDescr']))) . ' ' . $error_img, + 'remote_device'=>$arp_name, + 'remote_interface'=>$arp_if); + } + unset($ignore); +} + +$output = array('current'=>$current,'rowCount'=>$rowCount,'rows'=>$response,'total'=>$total); +echo _json_encode($output); diff --git a/html/pages/search/arp.inc.php b/html/pages/search/arp.inc.php index 8b02112383..5e7df42666 100644 --- a/html/pages/search/arp.inc.php +++ b/html/pages/search/arp.inc.php @@ -1,139 +1,91 @@ - +
+
+ ARP Entries +
+ + + + + + + + + + + + +
-
-
- - + diff --git a/html/pages/search/ipv6.inc.php b/html/pages/search/ipv6.inc.php index a557159f4b..39aeb028d3 100644 --- a/html/pages/search/ipv6.inc.php +++ b/html/pages/search/ipv6.inc.php @@ -1,96 +1,83 @@ - +
+
+ IPv6 Addresses +
+ + + + + + + + + + +
- -
- - +