summaryrefslogtreecommitdiffstats
path: root/usr/local/www/status_dhcpv6_leases.php
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-05-19 10:44:54 -0400
committerjim-p <jimp@pfsense.org>2011-05-19 10:44:54 -0400
commitbcb24b81f538adda46bc1c499f2ddd4c78dd50a9 (patch)
tree2bea16105823b088e29893d9295a9a9579fa848c /usr/local/www/status_dhcpv6_leases.php
parent153fa4475fc206948d8bfe6d204ade548f3db023 (diff)
downloadpfsense-bcb24b81f538adda46bc1c499f2ddd4c78dd50a9.zip
pfsense-bcb24b81f538adda46bc1c499f2ddd4c78dd50a9.tar.gz
Misc DHCPv6 lease view improvements (at least shows the IP...)
Diffstat (limited to 'usr/local/www/status_dhcpv6_leases.php')
-rw-r--r--usr/local/www/status_dhcpv6_leases.php26
1 files changed, 15 insertions, 11 deletions
diff --git a/usr/local/www/status_dhcpv6_leases.php b/usr/local/www/status_dhcpv6_leases.php
index 5a040cb..63d5a9e 100644
--- a/usr/local/www/status_dhcpv6_leases.php
+++ b/usr/local/www/status_dhcpv6_leases.php
@@ -116,15 +116,15 @@ $cleanpattern = "'{ gsub(\"#.*\", \"\");} { gsub(\";\", \"\"); print;}'";
$splitpattern = "'BEGIN { RS=\"}\";} {for (i=1; i<=NF; i++) printf \"%s \", \$i; printf \"}\\n\";}'";
/* stuff the leases file in a proper format into a array by line */
-exec("/bin/cat {$leasesfile} | {$awk} {$cleanpattern} | {$awk} {$splitpattern}", $leases_content);
+exec("/bin/cat {$leasesfile} | {$awk} {$cleanpattern} | {$awk} {$splitpattern} | /usr/bin/grep '^ia-na'", $leases_content);
$leases_count = count($leases_content);
-exec("/usr/sbin/arp -an", $rawdata);
+exec("/usr/sbin/ndp -an", $rawdata);
$arpdata = array();
foreach ($rawdata as $line) {
- $elements = explode(' ',$line);
- if ($elements[3] != "(incomplete)") {
+ $elements = preg_split('/\s+/ ',$line);
+ if ($elements[1] != "(incomplete)") {
$arpent = array();
- $arpent['ip'] = trim(str_replace(array('(',')'),'',$elements[1]));
+ $arpent['ip'] = trim(str_replace(array('(',')'),'',$elements[0]));
// $arpent['mac'] = trim($elements[3]);
// $arpent['interface'] = trim($elements[5]);
$arpdata[] = $arpent['ip'];
@@ -144,8 +144,8 @@ while($i < $leases_count) {
/* walk the fields */
$f = 0;
$fcount = count($data);
- /* with less then 20 fields there is nothing useful */
- if($fcount < 20) {
+ /* with less then 15 fields there is nothing useful */
+ if($fcount < 15) {
$i++;
continue;
}
@@ -162,11 +162,15 @@ while($i < $leases_count) {
$p++;
$i++;
continue 3;
- case "lease":
- $leases[$l]['ip'] = $data[$f+1];
+ case "ia-na":
+ $leases[$l]['duid'] = $data[$f+1];
$leases[$l]['type'] = "dynamic";
$f = $f+2;
break;
+ case "iaaddr":
+ $leases[$l]['ip'] = $data[$f+1];
+ $f = $f+2;
+ break;
case "starts":
$leases[$l]['start'] = $data[$f+2];
$leases[$l]['start'] .= " " . $data[$f+3];
@@ -383,7 +387,7 @@ foreach ($leases as $data) {
/* Only show the button for offline dynamic leases */
if (($data['type'] == "dynamic") && ($data['online'] != "online")) {
- echo "<td class=\"list\" valign=\"middle\"><a href=\"status_dhcp_leases.php?deleteip={$data['ip']}&all=" . htmlspecialchars($_GET['all']) . "\">";
+ echo "<td class=\"list\" valign=\"middle\"><a href=\"status_dhcpv6_leases.php?deleteip={$data['ip']}&all=" . htmlspecialchars($_GET['all']) . "\">";
echo "<img src=\"/themes/{$g['theme']}/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"" . gettext("delete this DHCP lease") . "\"></a></td>\n";
}
echo "</tr>\n";
@@ -393,7 +397,7 @@ foreach ($leases as $data) {
?>
</table>
<p>
-<form action="status_dhcp_leases.php" method="GET">
+<form action="status_dhcpv6_leases.php" method="GET">
<input type="hidden" name="order" value="<?=htmlspecialchars($_GET['order']);?>">
<?php if ($_GET['all']): ?>
<input type="hidden" name="all" value="0">
OpenPOWER on IntegriCloud