From 310f4f21ee1bef89988a1f41da778b88fc4d7215 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 8 Feb 2017 15:02:02 +0545 Subject: Part fix #7233 keep correct staticmap_array_index The index needs to be incremented even for entries that were skipped for display because they (for whatever reason) have no MAC or CID set. So use the key directly from the array. (cherry picked from commit 9aa3c5e84984958caa19ac76ecba849b94a8b360) --- src/usr/local/www/status_dhcp_leases.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/usr/local/www/status_dhcp_leases.php b/src/usr/local/www/status_dhcp_leases.php index 4f365de..6a4044a 100644 --- a/src/usr/local/www/status_dhcp_leases.php +++ b/src/usr/local/www/status_dhcp_leases.php @@ -312,8 +312,7 @@ $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) { + foreach ($config['dhcpd'][$ifname]['staticmap'] as $idx => $static) { if (!empty($static['mac']) || !empty($static['cid'])) { $slease = array(); $slease['ip'] = $static['ipaddr']; @@ -330,9 +329,8 @@ foreach ($config['interfaces'] as $ifname => $ifarr) { $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; + $slease['staticmap_array_index'] = $idx; $leases[] = $slease; - $staticmap_array_index++; } } } -- cgit v1.1