summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2016-10-19 12:13:02 +0930
committerRenato Botelho <renato@netgate.com>2016-10-25 13:35:02 -0200
commit7f798f24a920a80d73ebdefe94459cc0acea3752 (patch)
tree7fde8635cfb9712e076424fb802b1bb6b388fbb7
parent0b1715e9b75b7edb9cf3d96c339bb9473c1e4cd3 (diff)
downloadpfsense-7f798f24a920a80d73ebdefe94459cc0acea3752.zip
pfsense-7f798f24a920a80d73ebdefe94459cc0acea3752.tar.gz
Better handle no dhcpv6 leases file
(cherry picked from commit 2355c154b7598f937ba2121429659f5676ce4d96)
-rw-r--r--src/usr/local/www/status_dhcpv6_leases.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/usr/local/www/status_dhcpv6_leases.php b/src/usr/local/www/status_dhcpv6_leases.php
index a8b644a..8093e28 100644
--- a/src/usr/local/www/status_dhcpv6_leases.php
+++ b/src/usr/local/www/status_dhcpv6_leases.php
@@ -191,8 +191,15 @@ $cleanpattern = "'/^ia-.. /, /^}/ !d; s,;$,,; s, *, ,g'";
/* Join each block in single line */
$splitpattern = "'{printf $0}; $0 ~ /^\}/ {printf \"\\n\"}'";
-/* stuff the leases file in a proper format into a array by line */
-exec("{$sed} {$cleanpattern} {$leasesfile} | {$awk} {$splitpattern}", $leases_content);
+if (is_file($leasesfile)) {
+ /* stuff the leases file in a proper format into an array by line */
+ exec("{$sed} {$cleanpattern} {$leasesfile} | {$awk} {$splitpattern}", $leases_content);
+ $leasesfile_found = true;
+} else {
+ $leases_content = array();
+ $leasesfile_found = false;
+}
+
$leases_count = count($leases_content);
exec("/usr/sbin/ndp -an", $rawdata);
$ndpdata = array();
@@ -447,7 +454,7 @@ if (count($pools) > 0) {
/* only print pool status when we have one */
}
-if (empty($leases)) {
+if (!$leasesfile_found) {
print_info_box(gettext("No leases file found. Is the DHCPv6 server active?"), 'warning', false);
}
OpenPOWER on IntegriCloud