Project

General

Profile

Download (17.9 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	status_dhcpv6_leases.php
5
        Copyright (C) 2013-2014 Electric Sheep Fencing, LP
6
	Copyright (C) 2011 Seth Mos
7
	Copyright (C) 2004-2009 Scott Ullrich
8
	All rights reserved.
9

    
10
	originally part of m0n0wall (http://m0n0.ch/wall)
11
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
12
	All rights reserved.
13

    
14
	Redistribution and use in source and binary forms, with or without
15
	modification, are permitted provided that the following conditions are met:
16

    
17
	1. Redistributions of source code must retain the above copyright notice,
18
	   this list of conditions and the following disclaimer.
19

    
20
	2. Redistributions in binary form must reproduce the above copyright
21
	   notice, this list of conditions and the following disclaimer in the
22
	   documentation and/or other materials provided with the distribution.
23

    
24
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
25
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
26
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
28
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
	POSSIBILITY OF SUCH DAMAGE.
34
*/
35

    
36
/*
37
	pfSense_BUILDER_BINARIES:	/usr/bin/awk	/bin/cat	/usr/sbin/ndp	/usr/bin/wc	/usr/bin/grep
38
	pfSense_MODULE:	dhcpserver
39
*/
40

    
41
##|+PRIV
42
##|*IDENT=page-status-dhcpv6leases
43
##|*NAME=Status: DHCPv6 leases page
44
##|*DESCR=Allow access to the 'Status: DHCPv6 leases' page.
45
##|*MATCH=status_dhcpv6_leases.php*
46
##|-PRIV
47

    
48
require("guiconfig.inc");
49
require_once("config.inc");
50

    
51
$pgtitle = array(gettext("Status"),gettext("DHCPv6 leases"));
52
$shortcut_section = "dhcp6";
53

    
54
$leasesfile = "{$g['dhcpd_chroot_path']}/var/db/dhcpd6.leases";
55

    
56
if (($_GET['deleteip']) && (is_ipaddr($_GET['deleteip']))) {
57
	/* Stop DHCPD */
58
	killbyname("dhcpd");
59

    
60
	/* Read existing leases */
61
	$leases_contents = explode("\n", file_get_contents($leasesfile));
62
	$newleases_contents = array();
63
	$i=0;
64
	while ($i < count($leases_contents)) {
65
		/* Find the lease(s) we want to delete */
66
		if ($leases_contents[$i] == "  iaaddr {$_GET['deleteip']} {") {
67
			/* The iaaddr line is two lines down from the start of the lease, so remove those two lines. */
68
			array_pop($newleases_contents);
69
			array_pop($newleases_contents);
70
			/* Skip to the end of the lease declaration */
71
			do {
72
				$i++;
73
			} while ($leases_contents[$i] != "}");
74
		} else {
75
			/* It's a line we want to keep, copy it over. */
76
			$newleases_contents[] = $leases_contents[$i];
77
		}
78
		$i++;
79
	}
80

    
81
	/* Write out the new leases file */
82
	$fd = fopen($leasesfile, 'w');
83
	fwrite($fd, implode("\n", $newleases_contents));
84
	fclose($fd);
85

    
86
	/* Restart DHCP Service */
87
	services_dhcpd_configure();
88
	header("Location: status_dhcpv6_leases.php?all={$_GET['all']}");
89
}
90

    
91
// Load MAC-Manufacturer table
92
$mac_man = load_mac_manufacturer_table();
93

    
94
include("head.inc");
95

    
96
?>
97

    
98
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
99
<?php include("fbegin.inc"); ?>
100
<?php
101

    
102
function leasecmp($a, $b) {
103
	return strcmp($a[$_GET['order']], $b[$_GET['order']]);
104
}
105

    
106
function adjust_gmt($dt) {
107
	global $config;
108

    
109
	$dhcpv6leaseinlocaltime == "no";
110
	if (is_array($config['dhcpdv6'])) {
111
		$dhcpdv6 = $config['dhcpdv6'];
112
		foreach ($dhcpdv6 as $dhcpv6leaseinlocaltime) {
113
			$dhcpv6leaseinlocaltime = $dhcpv6leaseinlocaltime['dhcpv6leaseinlocaltime'];
114
			if ($dhcpv6leaseinlocaltime == "yes")
115
				break;
116
		}
117
	}
118

    
119
	$timezone = $config['system']['timezone'];
120
	$ts = strtotime($dt . " GMT");
121
	if ($dhcpv6leaseinlocaltime == "yes") {
122
		$this_tz = new DateTimeZone($timezone);
123
		$dhcp_lt = new DateTime(strftime("%I:%M:%S%p", $ts), $this_tz);
124
		$offset = $this_tz->getOffset($dhcp_lt);
125
		$ts = $ts + $offset;
126
		return strftime("%Y/%m/%d %I:%M:%S%p", $ts);
127
	}
128
	else
129
		return strftime("%Y/%m/%d %H:%M:%S", $ts);
130
}
131

    
132
function remove_duplicate($array, $field) {
133
	foreach ($array as $sub)
134
		$cmp[] = $sub[$field];
135
	$unique = array_unique(array_reverse($cmp,true));
136
	foreach ($unique as $k => $rien)
137
		$new[] = $array[$k];
138
	return $new;
139
}
140

    
141
function parse_duid($duid_string) {
142
	$parsed_duid = array();
143
	for ($i=0; $i < strlen($duid_string); $i++) {
144
		$s = substr($duid_string, $i, 1);
145
		if ($s == '\\') {
146
			$n = substr($duid_string, $i+1, 1);
147
			if (($n == '\\') || ($n == '"')) {
148
				$parsed_duid[] = sprintf("%02x", ord($n));
149
			} elseif (is_numeric($n)) {
150
				$parsed_duid[] = sprintf("%02x", octdec(substr($duid_string, $i+1, 3)));
151
				$i += 3;
152
			}
153
		} else {
154
			$parsed_duid[] = sprintf("%02x", ord($s));
155
		}
156
	}
157
	$iaid = array_slice($parsed_duid, 0, 4);
158
	$duid = array_slice($parsed_duid, 4);
159
	return array($iaid, $duid);
160
}
161

    
162
$awk = "/usr/bin/awk";
163

    
164
/* this pattern sticks comments into a single array item */
165
$cleanpattern = "'{ gsub(\"^#.*\", \"\");} { gsub(\"^server-duid.*\", \"\");} { gsub(\";$\", \"\"); print;}'";
166
/* We then split the leases file by } */
167
$splitpattern = "'BEGIN { RS=\"}\";} {for (i=1; i<=NF; i++) printf \"%s \", \$i; printf \"}\\n\";}'";
168

    
169
/* stuff the leases file in a proper format into a array by line */
170
exec("/bin/cat {$leasesfile} | {$awk} {$cleanpattern} | {$awk} {$splitpattern} | /usr/bin/grep '^ia-.. '", $leases_content);
171
$leases_count = count($leases_content);
172
exec("/usr/sbin/ndp -an", $rawdata);
173
$ndpdata = array();
174
foreach ($rawdata as $line) {
175
	$elements = preg_split('/\s+/ ',$line);
176
	if ($elements[1] != "(incomplete)") {
177
		$ndpent = array();
178
		$ip = trim(str_replace(array('(',')'),'',$elements[0]));
179
		$ndpent['mac'] = trim($elements[1]);
180
		$ndpent['interface'] = trim($elements[2]);
181
		$ndpdata[$ip] = $ndpent;
182
	}
183
}
184

    
185
$pools = array();
186
$leases = array();
187
$prefixes = array();
188
$mappings = array();
189
$i = 0;
190
$l = 0;
191
$p = 0;
192

    
193
// Put everything together again
194
while($i < $leases_count) {
195
	$entry = array();
196
	/* split the line by space */
197
	$duid_split = array();
198
	preg_match('/ia-.. "(.*)" { (.*)/ ', $leases_content[$i], $duid_split);
199
	if (!empty($duid_split[1])) {
200
		$iaid_duid = parse_duid($duid_split[1]);
201
		$entry['iaid'] = hexdec(implode("", array_reverse($iaid_duid[0])));
202
		$entry['duid'] = implode(":", $iaid_duid[1]);
203
		$data = explode(" ", $duid_split[2]);
204
	} else {
205
		$data = explode(" ", $leases_content[$i]);
206
	}
207
	/* walk the fields */
208
	$f = 0;
209
	$fcount = count($data);
210
	/* with less then 12 fields there is nothing useful */
211
	if($fcount < 12) {
212
		$i++;
213
		continue;
214
	}
215
	while($f < $fcount) {
216
		switch($data[$f]) {
217
			case "failover":
218
				$pools[$p]['name'] = $data[$f+2];
219
				$pools[$p]['mystate'] = $data[$f+7];
220
				$pools[$p]['peerstate'] = $data[$f+14];
221
				$pools[$p]['mydate'] = $data[$f+10];
222
				$pools[$p]['mydate'] .= " " . $data[$f+11];
223
				$pools[$p]['peerdate'] = $data[$f+17];
224
				$pools[$p]['peerdate'] .= " " . $data[$f+18];
225
				$p++;
226
				$i++;
227
				continue 3;
228
			case "ia-pd":
229
				$is_prefix = true;
230
			case "ia-na":
231
				$entry['iaid'] = $tmp_iaid;
232
				$entry['duid'] = $tmp_duid;
233
				if ($data[$f+1][0] == '"') {
234
					$duid = "";
235
					/* FIXME: This needs a safety belt to prevent an infinite loop */
236
					while ($data[$f][strlen($data[$f])-1] != '"') {
237
						$duid .= " " . $data[$f+1];
238
						$f++;
239
					}
240
					$entry['duid'] = $duid;
241
				} else {
242
					$entry['duid'] = $data[$f+1];
243
				}
244
				$entry['type'] = "dynamic";
245
				$f = $f+2;
246
				break;
247
			case "iaaddr":
248
				$entry['ip'] = $data[$f+1];
249
				$entry['type'] = "dynamic";
250
				if (in_array($entry['ip'], array_keys($ndpdata))) {
251
					$entry['online'] = 'online';
252
				} else {
253
					$entry['online'] = 'offline';
254
				}
255
				$f = $f+2;
256
				break;
257
			case "iaprefix":
258
				$is_prefix = true;
259
				$entry['prefix'] = $data[$f+1];
260
				$entry['type'] = "dynamic";
261
				$f = $f+2;
262
				break;
263
			case "starts":
264
				$entry['start'] = $data[$f+2];
265
				$entry['start'] .= " " . $data[$f+3];
266
				$f = $f+3;
267
				break;
268
			case "ends":
269
				$entry['end'] = $data[$f+2];
270
				$entry['end'] .= " " . $data[$f+3];
271
				$f = $f+3;
272
				break;
273
			case "tstp":
274
				$f = $f+3;
275
				break;
276
			case "tsfp":
277
				$f = $f+3;
278
				break;
279
			case "atsfp":
280
				$f = $f+3;
281
				break;
282
			case "cltt":
283
				$entry['start'] = $data[$f+2];
284
				$entry['start'] .= " " . $data[$f+3];
285
				$f = $f+3;
286
				break;
287
			case "binding":
288
				switch($data[$f+2]) {
289
					case "active":
290
						$entry['act'] = "active";
291
						break;
292
					case "free":
293
						$entry['act'] = "expired";
294
						$entry['online'] = "offline";
295
						break;
296
					case "backup":
297
						$entry['act'] = "reserved";
298
						$entry['online'] = "offline";
299
						break;
300
					case "released":
301
						$entry['act'] = "released";
302
						$entry['online'] = "offline";
303
				}
304
				$f = $f+1;
305
				break;
306
			case "next":
307
				/* skip the next binding statement */
308
				$f = $f+3;
309
				break;
310
			case "hardware":
311
				$f = $f+2;
312
				break;
313
			case "client-hostname":
314
				if($data[$f+1] <> "") {
315
					$entry['hostname'] = preg_replace('/"/','',$data[$f+1]);
316
				} else {
317
					$hostname = gethostbyaddr($entry['ip']);
318
					if($hostname <> "") {
319
						$entry['hostname'] = $hostname;
320
					}
321
				}
322
				$f = $f+1;
323
				break;
324
			case "uid":
325
				$f = $f+1;
326
				break;
327
		}
328
		$f++;
329
	}
330
	if ($is_prefix) {
331
		$prefixes[] = $entry;
332
	} else {
333
		$leases[] = $entry;
334
		$mappings[$entry['iaid'] . $entry['duid']] = $entry['ip'];
335
	}
336
	$l++;
337
	$i++;
338
	$is_prefix = false;
339
}
340

    
341
if(count($leases) > 0) {
342
	$leases = remove_duplicate($leases,"ip");
343
}
344

    
345
if(count($prefixes) > 0) {
346
	$prefixes = remove_duplicate($prefixes,"prefix");
347
}
348

    
349
if(count($pools) > 0) {
350
	$pools = remove_duplicate($pools,"name");
351
	asort($pools);
352
}
353

    
354
foreach($config['interfaces'] as $ifname => $ifarr) {
355
	if (is_array($config['dhcpdv6'][$ifname]) &&
356
		is_array($config['dhcpdv6'][$ifname]['staticmap'])) {
357
		foreach($config['dhcpdv6'][$ifname]['staticmap'] as $static) {
358
			$slease = array();
359
			$slease['ip'] = $static['ipaddrv6'];
360
			$slease['type'] = "static";
361
			$slease['duid'] = $static['duid'];
362
			$slease['start'] = "";
363
			$slease['end'] = "";
364
			$slease['hostname'] = htmlentities($static['hostname']);
365
			$slease['act'] = "static";
366
			if (in_array($slease['ip'], array_keys($ndpdata))) {
367
				$slease['online'] = 'online';
368
			} else {
369
				$slease['online'] = 'offline';
370
			}
371

    
372
			$leases[] = $slease;
373
		}
374
	}
375
}
376

    
377
if ($_GET['order'])
378
	usort($leases, "leasecmp");
379

    
380
/* only print pool status when we have one */
381
if(count($pools) > 0) {
382
?>
383
<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="dhcp leases">
384
	<tr>
385
		<td class="listhdrr"><?=gettext("Failover Group"); ?></a></td>
386
		<td class="listhdrr"><?=gettext("My State"); ?></a></td>
387
		<td class="listhdrr"><?=gettext("Since"); ?></a></td>
388
		<td class="listhdrr"><?=gettext("Peer State"); ?></a></td>
389
		<td class="listhdrr"><?=gettext("Since"); ?></a></td>
390
	</tr>
391
<?php
392
foreach ($pools as $data) {
393
	echo "<tr>\n";
394
	echo "<td class=\"listlr\">{$fspans}{$data['name']}{$fspane}</td>\n";
395
	echo "<td class=\"listr\">{$fspans}{$data['mystate']}{$fspane}</td>\n";
396
	echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['mydate']) . "{$fspane}</td>\n";
397
	echo "<td class=\"listr\">{$fspans}{$data['peerstate']}{$fspane}</td>\n";
398
	echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['peerdate']) . "{$fspane}</td>\n";
399
	echo "<td class=\"list\" valign=\"middle\" width=\"17\">&nbsp;</td>\n";
400
	echo "<td class=\"list\" valign=\"middle\" width=\"17\">&nbsp;</td>\n";
401
	echo "</tr>\n";
402
}
403

    
404
?>
405
</table>
406

    
407
<?php
408
/* only print pool status when we have one */
409
}
410
?>
411

    
412
<br/>
413

    
414
<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="dhcp leases">
415
  <tr>
416
    <td class="listhdrr"><a href="#"><?=gettext("IPv6 address"); ?></a></td>
417
    <td class="listhdrr"><a href="#"><?=gettext("IAID"); ?></a></td>
418
    <td class="listhdrr"><a href="#"><?=gettext("DUID"); ?></a></td>
419
    <td class="listhdrr"><a href="#"><?=gettext("Hostname/MAC"); ?></a></td>
420
    <td class="listhdrr"><a href="#"><?=gettext("Start"); ?></a></td>
421
    <td class="listhdrr"><a href="#"><?=gettext("End"); ?></a></td>
422
    <td class="listhdrr"><a href="#"><?=gettext("Online"); ?></a></td>
423
    <td class="listhdrr"><a href="#"><?=gettext("Lease Type"); ?></a></td>
424
	</tr>
425
<?php
426
foreach ($leases as $data) {
427
	if (($data['act'] == "active") || ($data['act'] == "static") || ($_GET['all'] == 1)) {
428
		if ($data['act'] != "active" && $data['act'] != "static") {
429
			$fspans = "<span class=\"gray\">";
430
			$fspane = "&nbsp;</span>";
431
		} else {
432
			$fspans = "";
433
			$fspane = "&nbsp;";
434
		}
435

    
436
		if ($data['act'] == "static") {
437
			foreach ($config['dhcpdv6'] as $dhcpif => $dhcpifconf) {
438
				if(is_array($dhcpifconf['staticmap'])) {
439
					foreach ($dhcpifconf['staticmap'] as $staticent) {
440
						if ($data['ip'] == $staticent['ipaddr']) {
441
							$data['if'] = $dhcpif;
442
							break;
443
						}
444
					}
445
				}
446
				/* exit as soon as we have an interface */
447
				if ($data['if'] != "")
448
					break;
449
			}
450
		} else {
451
			$data['if'] = convert_real_interface_to_friendly_interface_name(guess_interface_from_ip($data['ip']));
452
		}
453
		echo "<tr>\n";
454
		echo "<td class=\"listlr\">{$fspans}{$data['ip']}{$fspane}</td>\n";
455
		echo "<td class=\"listr\">{$fspans}{$data['iaid']}{$fspane}</td>\n";
456
		echo "<td class=\"listr\">{$fspans}{$data['duid']}{$fspane}</td>\n";
457
		echo "<td class=\"listr\">{$fspans}";
458
		if (!empty($data['hostname'])) {
459
			echo htmlentities($data['hostname']) . "<br />";
460
		}
461

    
462
		$mac=trim($ndpdata[$data['ip']]['mac']);
463
		if (!empty($mac)) {
464
			$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
465
			print htmlentities($mac);
466
			if(isset($mac_man[$mac_hi])){ print "<br /><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>"; }
467
		}
468

    
469
		echo "{$fspane}&nbsp;</td>\n";
470
		if ($data['type'] != "static") {
471
			echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['start']) . "{$fspane}</td>\n";
472
			echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['end']) . "{$fspane}</td>\n";
473
		} else {
474
			echo "<td class=\"listr\">{$fspans} n/a {$fspane}</td>\n";
475
			echo "<td class=\"listr\">{$fspans} n/a {$fspane}</td>\n";
476
		}
477
		echo "<td class=\"listr\">{$fspans}{$data['online']}{$fspane}</td>\n";
478
		echo "<td class=\"listr\">{$fspans}{$data['act']}{$fspane}</td>\n";
479

    
480
		if ($data['type'] == "dynamic") {
481
			echo "<td valign=\"middle\"><a href=\"services_dhcpv6_edit.php?if={$data['if']}&amp;duid={$data['duid']}&amp;hostname={$data['hostname']}\">";
482
			echo "<img src=\"/themes/{$g['theme']}/images/icons/icon_plus.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"" . gettext("add a static mapping for this MAC address") ."\" alt=\"add\" /></a></td>\n";
483
		} else {
484
			echo "<td class=\"list\" valign=\"middle\">";
485
			echo "<img src=\"/themes/{$g['theme']}/images/icons/icon_plus_mo.gif\" width=\"17\" height=\"17\" border=\"0\" alt=\"add\" /></td>\n";
486
		}
487

    
488
		/* Only show the button for offline dynamic leases */
489
		if (($data['type'] == "dynamic") && ($data['online'] != "online")) {
490
			echo "<td class=\"list\" valign=\"middle\"><a href=\"status_dhcpv6_leases.php?deleteip={$data['ip']}&amp;all=" . htmlspecialchars($_GET['all']) . "\">";
491
			echo "<img src=\"/themes/{$g['theme']}/images/icons/icon_x.gif\" width=\"17\" height=\"17\" border=\"0\" title=\"" . gettext("delete this DHCP lease") . "\" alt=\"delete\" /></a></td>\n";
492
		}
493
		echo "</tr>\n";
494
	}
495
}
496
?>
497
</table>
498
<br/>
499
<h3>Delegated Prefixes</h3>
500
<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="prefixes">
501
	<tr>
502
		<td class="listhdrr"><a href="#"><?=gettext("IPv6 Prefix"); ?></a></td>
503
		<td class="listhdrr"><a href="#"><?=gettext("IAID"); ?></a></td>
504
		<td class="listhdrr"><a href="#"><?=gettext("DUID"); ?></a></td>
505
		<td class="listhdrr"><a href="#"><?=gettext("Start"); ?></a></td>
506
		<td class="listhdrr"><a href="#"><?=gettext("End"); ?></a></td>
507
		<td class="listhdrr"><a href="#"><?=gettext("State"); ?></a></td>
508
	</tr>
509
<?php
510
foreach ($prefixes as $data) {
511
	if (($data['act'] == "active") || ($data['act'] == "static") || ($_GET['all'] == 1)) {
512
		if ($data['act'] != "active" && $data['act'] != "static") {
513
			$fspans = "<span class=\"gray\">";
514
			$fspane = "&nbsp;</span>";
515
		} else {
516
			$fspans = "";
517
			$fspane = "&nbsp;";
518
		}
519

    
520
		if ($data['act'] == "static") {
521
			foreach ($config['dhcpdv6'] as $dhcpif => $dhcpifconf) {
522
				if(is_array($dhcpifconf['staticmap'])) {
523
					foreach ($dhcpifconf['staticmap'] as $staticent) {
524
						if ($data['ip'] == $staticent['ipaddr']) {
525
							$data['if'] = $dhcpif;
526
							break;
527
						}
528
					}
529
				}
530
				/* exit as soon as we have an interface */
531
				if ($data['if'] != "")
532
					break;
533
			}
534
		} else {
535
			$data['if'] = convert_real_interface_to_friendly_interface_name(guess_interface_from_ip($data['ip']));
536
		}
537
		echo "<tr>\n";
538
		if ($mappings[$data['iaid'] . $data['duid']]) {
539
			$dip = "<br />Routed To: {$mappings[$data['iaid'] . $data['duid']]}";
540
		}
541
		echo "<td class=\"listlr\">{$fspans}{$data['prefix']}{$dip}{$fspane}</td>\n";
542
		echo "<td class=\"listr\">{$fspans}{$data['iaid']}{$fspane}</td>\n";
543
		echo "<td class=\"listr\">{$fspans}{$data['duid']}{$fspane}</td>\n";
544
		if ($data['type'] != "static") {
545
			echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['start']) . "{$fspane}</td>\n";
546
			echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['end']) . "{$fspane}</td>\n";
547
		} else {
548
			echo "<td class=\"listr\">{$fspans} n/a {$fspane}</td>\n";
549
			echo "<td class=\"listr\">{$fspans} n/a {$fspane}</td>\n";
550
		}
551
		echo "<td class=\"listr\">{$fspans}{$data['act']}{$fspane}</td>\n";
552
		echo "</tr>\n";
553
	}
554
}
555
?>
556
</table>
557
<br/>
558
<form action="status_dhcpv6_leases.php" method="get">
559
<input type="hidden" name="order" value="<?=htmlspecialchars($_GET['order']);?>" />
560
<?php if ($_GET['all']): ?>
561
<input type="hidden" name="all" value="0" />
562
<input type="submit" class="formbtn" value="<?=gettext("Show active and static leases only"); ?>" />
563
<?php else: ?>
564
<input type="hidden" name="all" value="1" />
565
<input type="submit" class="formbtn" value="<?=gettext("Show all configured leases"); ?>" />
566
<?php endif; ?>
567
</form>
568
<?php if($leases == 0): ?>
569
<p><strong><?=gettext("No leases file found. Is the DHCP server active"); ?>?</strong></p>
570
<?php endif; ?>
571

    
572
<?php include("fend.inc"); ?>
573
</body>
574
</html>
(186-186/256)