summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/usr/local/sbin/prefixes.php4
-rw-r--r--src/usr/local/www/status_dhcpv6_leases.php17
2 files changed, 13 insertions, 8 deletions
diff --git a/src/usr/local/sbin/prefixes.php b/src/usr/local/sbin/prefixes.php
index 048fc11..2626c30 100644
--- a/src/usr/local/sbin/prefixes.php
+++ b/src/usr/local/sbin/prefixes.php
@@ -47,7 +47,7 @@ while (( $line = fgets($fd, 4096)) !== false) {
/* closing bracket */
if (preg_match("/^}/i", $line)) {
- if (isset($duid) && $duid !== false) {
+ if (isset($duid) && $duid !== false && $active === true) {
switch ($type) {
case "ia-na":
$duid_arr[$duid][$type] = $ia_na;
@@ -119,7 +119,7 @@ function extract_duid($ia_string) {
continue;
}
else if ($len - $i >= 4) {
- if (preg_match('/[0-7]{3}/', substr($ia_string, $i+1, $i+4))) {
+ if (preg_match('/[0-3][0-7]{2}/', substr($ia_string, $i+1, 3))) {
$i += 3;
continue;
}
diff --git a/src/usr/local/www/status_dhcpv6_leases.php b/src/usr/local/www/status_dhcpv6_leases.php
index 87c1ad4..9b7f37e 100644
--- a/src/usr/local/www/status_dhcpv6_leases.php
+++ b/src/usr/local/www/status_dhcpv6_leases.php
@@ -162,9 +162,13 @@ function parse_duid($duid_string) {
$n = substr($duid_string, $i+1, 1);
if (($n == '\\') || ($n == '"')) {
$parsed_duid[] = sprintf("%02x", ord($n));
- } elseif (is_numeric($n)) {
- $parsed_duid[] = sprintf("%02x", octdec(substr($duid_string, $i+1, 3)));
- $i += 3;
+ $i += 1;
+ } else {
+ $n = substr($duid_string, $i+1, 3);
+ if (preg_match('/[0-3][0-7]{2}/', $n)) {
+ $parsed_duid[] = sprintf("%02x", octdec($n));
+ $i += 3;
+ }
}
} else {
$parsed_duid[] = sprintf("%02x", ord($s));
@@ -357,7 +361,7 @@ while ($i < $leases_count) {
$prefixes[] = $entry;
} else {
$leases[] = $entry;
- $mappings[$entry['iaid'] . $entry['duid']] = $entry['ip'];
+ $mappings[$entry['duid']] = $entry['ip'];
}
$l++;
$i++;
@@ -543,6 +547,7 @@ foreach ($leases as $data):
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
<thead>
<tr>
+ <th><!-- icon --></th>
<th><?=gettext("IPv6 Prefix")?></th>
<th><?=gettext("IAID")?></th>
<th><?=gettext("DUID")?></th>
@@ -593,9 +598,9 @@ foreach ($prefixes as $data):
<td><i class="fa <?=$icon?>"></i></td>
<td>
<?=$data['prefix']?>
-<?php if ($mappings[$data['iaid'] . $data['duid']]): ?>
+<?php if ($mappings[$data['duid']]): ?>
<br />
- <?=gettext('Routed To')?>: <?=$mappings[$data['iaid'] . $data['duid']]?>
+ <?=gettext('Routed To')?>: <?=$mappings[$data['duid']]?>
<?php endif; ?>
</td>
<td><?=$data['iaid']?></td>
OpenPOWER on IntegriCloud