From ffdcbeb67b3b8bea0e381e9d969fb4743eff7754 Mon Sep 17 00:00:00 2001 From: jim-p Date: Sun, 19 Jun 2011 12:39:11 -0400 Subject: Also ignore lines starting with server-duid, and fix the # ignore so it is anchored on the start of the line. Add a note to fix a loop later that can fall into infinity. --- usr/local/www/status_dhcpv6_leases.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'usr/local') diff --git a/usr/local/www/status_dhcpv6_leases.php b/usr/local/www/status_dhcpv6_leases.php index 7ca05f8..0f79666 100644 --- a/usr/local/www/status_dhcpv6_leases.php +++ b/usr/local/www/status_dhcpv6_leases.php @@ -110,8 +110,9 @@ function remove_duplicate($array, $field) } $awk = "/usr/bin/awk"; + /* this pattern sticks comments into a single array item */ -$cleanpattern = "'{ gsub(\"#.*\", \"\");} { gsub(\";\", \"\"); print;}'"; +$cleanpattern = "'{ gsub(\"^#.*\", \"\");} { gsub(\"^server-duid.*\", \"\");} { gsub(\";\", \"\"); print;}'"; /* We then split the leases file by } */ $splitpattern = "'BEGIN { RS=\"}\";} {for (i=1; i<=NF; i++) printf \"%s \", \$i; printf \"}\\n\";}'"; @@ -165,6 +166,7 @@ while($i < $leases_count) { case "ia-na": if ($data[$f+1][0] == '"') { $duid = ""; + /* FIXME: This needs a safety belt to prevent an infinite loop */ while ($data[$f][strlen($data[$f])-1] != '"') { $duid .= " " . $data[$f+1]; $f++; -- cgit v1.1