Commit 9c992c6a authored by Franco Fichtner's avatar Franco Fichtner

dhcp: interface column for leases; closes #860

Getting crowded...

(cherry picked from commit ce942771)
parent a38c6aeb
......@@ -74,6 +74,7 @@ function remove_duplicate($array, $field)
return $new;
}
$interfaces = legacy_config_get_interfaces(array('virtual' => false));
$leasesfile = services_dhcpd_leasesfile();
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
......@@ -226,7 +227,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
asort($pools);
}
foreach (legacy_config_get_interfaces(array("virtual" => false)) as $ifname => $ifarr) {
foreach ($interfaces as $ifname => $ifarr) {
if (isset($config['dhcpd'][$ifname]['staticmap'])) {
foreach($config['dhcpd'][$ifname]['staticmap'] as $static) {
$slease = array();
......@@ -355,6 +356,7 @@ include("head.inc");?>
<table class="table table-striped">
<thead>
<tr>
<td class="act_sort" data-field="if"><?=gettext("Interface"); ?></td>
<td class="act_sort" data-field="ip"><?=gettext("IP address"); ?></td>
<td class="act_sort" data-field="mac"><?=gettext("MAC address"); ?></td>
<td class="act_sort" data-field="hostname"><?=gettext("Hostname"); ?></td>
......@@ -386,6 +388,7 @@ include("head.inc");?>
if(is_array($dhcpifconf['staticmap'])) {
foreach ($dhcpifconf['staticmap'] as $staticent) {
if ($data['ip'] == $staticent['ipaddr']) {
$data['int'] = htmlspecialchars($interfaces[$dhcpif]['descr']);
$data['if'] = $dhcpif;
break;
}
......@@ -402,6 +405,7 @@ include("head.inc");?>
continue;
}
if (($lip >= ip2ulong($dhcpifconf['range']['from'])) && ($lip <= ip2ulong($dhcpifconf['range']['to']))) {
$data['int'] = htmlspecialchars($interfaces[$dhcpif]['descr']);
$data['if'] = $dhcpif;
break;
}
......@@ -410,6 +414,7 @@ include("head.inc");?>
$mac_hi = strtoupper($data['mac'][0] . $data['mac'][1] . $data['mac'][3] . $data['mac'][4] . $data['mac'][6] . $data['mac'][7]);
?>
<tr>
<td><?=$data['int'];?></td>
<td><?=$data['ip'];?></td>
<td>
<a href="services_wol.php?if=<?=$data['if'];?>&amp;mac=<?=$data['mac'];?>" title="<?=gettext("send Wake on LAN packet to this MAC address");?>">
......
......@@ -96,6 +96,7 @@ function parse_duid($duid_string) {
return array($iaid, $duid);
}
$interfaces = legacy_config_get_interfaces(array('virtual' => false));
$leasesfile = services_dhcpdv6_leasesfile();
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
......@@ -291,7 +292,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
asort($pools);
}
foreach (legacy_config_get_interfaces(array("virtual" => false)) as $ifname => $ifarr) {
foreach ($interfaces as $ifname => $ifarr) {
if (isset($config['dhcpdv6'][$ifname]['staticmap'])) {
foreach($config['dhcpdv6'][$ifname]['staticmap'] as $static) {
$slease = array();
......@@ -426,6 +427,7 @@ endif;?>
<table class="table table-striped">
<thead>
<tr>
<th><?=gettext("Interface"); ?></td>
<th><?=gettext("IPv6 address"); ?></th>
<th><?=gettext("IAID"); ?></th>
<th><?=gettext("DUID"); ?></th>
......@@ -447,6 +449,7 @@ endif;?>
if (is_array($dhcpifconf['staticmap'])) {
foreach ($dhcpifconf['staticmap'] as $staticent) {
if ($data['ip'] == $staticent['ipaddr']) {
$data['int'] = htmlspecialchars($interfaces[$dhcpif]['descr']);
$data['if'] = $dhcpif;
break;
}
......@@ -459,9 +462,11 @@ endif;?>
}
} else {
$data['if'] = convert_real_interface_to_friendly_interface_name(guess_interface_from_ip($data['ip']));
$data['int'] = htmlspecialchars($interfaces[$data['if']]['descr']);
}
?>
<tr>
<td><?=$data['int'];?></td>
<td><?=$data['ip'];?></td>
<td><?=$data['iaid'];?></td>
<td><?=$data['duid'];?></td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment