From 2fdc826253202c2c093bd5f81cbba101d29bf25a Mon Sep 17 00:00:00 2001 From: jim-p Date: Wed, 21 Sep 2011 14:04:56 -0400 Subject: Show MAC address on DHCPv6 output. (Not that it's used in the same way for DHCPv6 as it is for v4, but it's handy to see in one place) --- usr/local/www/status_dhcpv6_leases.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/usr/local/www/status_dhcpv6_leases.php b/usr/local/www/status_dhcpv6_leases.php index 5208f73..76358e3 100644 --- a/usr/local/www/status_dhcpv6_leases.php +++ b/usr/local/www/status_dhcpv6_leases.php @@ -145,10 +145,10 @@ foreach ($rawdata as $line) { $elements = preg_split('/\s+/ ',$line); if ($elements[1] != "(incomplete)") { $arpent = array(); - $arpent['ip'] = trim(str_replace(array('(',')'),'',$elements[0])); - // $arpent['mac'] = trim($elements[3]); - // $arpent['interface'] = trim($elements[5]); - $arpdata[] = $arpent['ip']; + $ip = trim(str_replace(array('(',')'),'',$elements[0])); + $arpent['mac'] = trim($elements[1]); + $arpent['interface'] = trim($elements[2]); + $arpdata[$ip] = $arpent; } } @@ -209,7 +209,7 @@ while($i < $leases_count) { break; case "iaaddr": $leases[$l]['ip'] = $data[$f+1]; - if (in_array($leases[$l]['ip'], $arpdata)) { + if (in_array($leases[$l]['ip'], array_keys($arpdata))) { $leases[$l]['online'] = 'online'; } else { $leases[$l]['online'] = 'offline'; @@ -358,7 +358,7 @@ foreach ($pools as $data) { - + @@ -400,7 +400,12 @@ foreach ($leases as $data) { echo "{$fspans}{$data['ip']}{$fspane} \n"; echo "{$fspans}{$data['iaid']}{$fspane} \n"; echo "{$fspans}{$data['duid']}{$fspane} \n"; - echo "{$fspans}" . htmlentities($data['hostname']) . "{$fspane} \n"; + echo "{$fspans}"; + if (!empty($data['hostname'])) { + echo htmlentities($data['hostname']) . "
"; + } + echo htmlentities($arpdata[$data['ip']]['mac']); + echo "{$fspane} \n"; if ($data['type'] != "static") { echo "{$fspans}" . adjust_gmt($data['start']) . "{$fspane} \n"; echo "{$fspans}" . adjust_gmt($data['end']) . "{$fspane} \n"; -- cgit v1.1