summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-12-13 18:07:04 -0200
committerRenato Botelho <renato@netgate.com>2016-12-13 18:07:04 -0200
commitaed5681ae058b0e37868770908e804e3b621723a (patch)
tree968a9ef2acf4b2cafee01959c913c0a27f7e4d64 /src/usr
parent5fda51cd2af8a099b89f35439343744dbe981fa1 (diff)
parentdadc11d7a7aae33ef284a4f8f4258d04e17d27fc (diff)
downloadpfsense-aed5681ae058b0e37868770908e804e3b621723a.zip
pfsense-aed5681ae058b0e37868770908e804e3b621723a.tar.gz
Merge pull request #3277 from phil-davis/patch-2
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/local/www/status_dhcp_leases.php71
1 files changed, 56 insertions, 15 deletions
diff --git a/src/usr/local/www/status_dhcp_leases.php b/src/usr/local/www/status_dhcp_leases.php
index 0f92537..60748d4 100644
--- a/src/usr/local/www/status_dhcp_leases.php
+++ b/src/usr/local/www/status_dhcp_leases.php
@@ -275,25 +275,33 @@ if (count($pools) > 0) {
asort($pools);
}
+$got_cid = false;
+
foreach ($config['interfaces'] as $ifname => $ifarr) {
if (is_array($config['dhcpd'][$ifname]) &&
is_array($config['dhcpd'][$ifname]['staticmap'])) {
$staticmap_array_index = 0;
foreach ($config['dhcpd'][$ifname]['staticmap'] as $static) {
- $slease = array();
- $slease['ip'] = $static['ipaddr'];
- $slease['type'] = $static_string;
- $slease['mac'] = $static['mac'];
- $slease['if'] = $ifname;
- $slease['start'] = "";
- $slease['end'] = "";
- $slease['hostname'] = htmlentities($static['hostname']);
- $slease['descr'] = htmlentities($static['descr']);
- $slease['act'] = $static_string;
- $slease['online'] = in_array(strtolower($slease['mac']), $arpdata_mac) ? $online_string : $offline_string;
- $slease['staticmap_array_index'] = $staticmap_array_index;
- $leases[] = $slease;
- $staticmap_array_index++;
+ if (!empty($static['mac']) || !empty($static['cid'])) {
+ $slease = array();
+ $slease['ip'] = $static['ipaddr'];
+ $slease['type'] = $static_string;
+ if (!empty($static['cid'])) {
+ $slease['cid'] = $static['cid'];
+ $got_cid = true;
+ }
+ $slease['mac'] = $static['mac'];
+ $slease['if'] = $ifname;
+ $slease['start'] = "";
+ $slease['end'] = "";
+ $slease['hostname'] = htmlentities($static['hostname']);
+ $slease['descr'] = htmlentities($static['descr']);
+ $slease['act'] = $static_string;
+ $slease['online'] = in_array(strtolower($slease['mac']), $arpdata_mac) ? $online_string : $offline_string;
+ $slease['staticmap_array_index'] = $staticmap_array_index;
+ $leases[] = $slease;
+ $staticmap_array_index++;
+ }
}
}
}
@@ -345,6 +353,14 @@ if (count($pools) > 0) {
<th><!-- icon --></th>
<th><?=gettext("IP address")?></th>
<th><?=gettext("MAC address")?></th>
+<?php
+/* only make CID column when we have one */
+if ($got_cid) {
+?>
+ <th><?=gettext("Client Id")?></th>
+<?php
+}
+?>
<th><?=gettext("Hostname")?></th>
<th><?=gettext("Description")?></th>
<th><?=gettext("Start")?></th>
@@ -358,12 +374,15 @@ if (count($pools) > 0) {
<?php
$dhcp_leases_subnet_counter = array(); //array to sum up # of leases / subnet
$iflist = get_configured_interface_with_descr(); //get interface descr for # of leases
+$no_leases_displayed = true;
foreach ($leases as $data):
if ($data['act'] != $active_string && $data['act'] != $static_string && $_GET['all'] != 1) {
continue;
}
+ $no_leases_displayed = false;
+
if ($data['act'] == $active_string) {
/* Active DHCP Lease */
$icon = 'fa-check-circle-o';
@@ -422,6 +441,14 @@ foreach ($leases as $data):
(<?=$mac_man[$mac_hi]?>)
<?php endif; ?>
</td>
+<?php
+/* only make CID column when we have one */
+if ($got_cid) {
+?>
+ <td><?=$data['cid']?></td>
+<?php
+}
+?>
<td><?=$data['hostname']?></td>
<td><?=$data['descr']?></td>
<? if ($data['type'] != "static"): ?>
@@ -450,6 +477,12 @@ foreach ($leases as $data):
</td>
</tr>
<?php endforeach; ?>
+<?php if ($no_leases_displayed): ?>
+ <tr>
+ <td></td>
+ <td><?=gettext("No leases to display")?></td>
+ </tr>
+<?php endif; ?>
</tbody>
</table>
</div>
@@ -469,6 +502,7 @@ foreach ($leases as $data):
</thead>
<tbody>
<?php
+if (count($dhcp_leases_subnet_counter)):
ksort($dhcp_leases_subnet_counter);
foreach ($dhcp_leases_subnet_counter as $listcounters):
?>
@@ -478,7 +512,14 @@ foreach ($leases as $data):
<td><?=$listcounters['to']?></td>
<td><?=$listcounters['count']?></td>
</tr>
-<?php endforeach; ?>
+<?php
+ endforeach;
+else:
+?>
+ <tr>
+ <td><?=gettext("No leases are in use")?></td>
+ </tr>
+<?php endif; ?>
</tbody>
</table>
</div>
OpenPOWER on IntegriCloud