Project

General

Profile

Download (18 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	status_dhcpv6_leases.php
5
	Copyright (C) 2013-2015 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

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

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

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

    
165
$awk = "/usr/bin/awk";
166

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

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

    
188
$pools = array();
189
$leases = array();
190
$prefixes = array();
191
$mappings = array();
192
$i = 0;
193
$l = 0;
194
$p = 0;
195

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

    
344
if (count($leases) > 0) {
345
	$leases = remove_duplicate($leases,"ip");
346
}
347

    
348
if (count($prefixes) > 0) {
349
	$prefixes = remove_duplicate($prefixes,"prefix");
350
}
351

    
352
if (count($pools) > 0) {
353
	$pools = remove_duplicate($pools,"name");
354
	asort($pools);
355
}
356

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

    
375
			$leases[] = $slease;
376
		}
377
	}
378
}
379

    
380
if ($_GET['order']) {
381
	usort($leases, "leasecmp");
382
}
383

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

    
410
<?php
411
/* only print pool status when we have one */
412
}
413
?>
414

    
415
<br/>
416

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

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

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

    
475
		echo "{$fspane}&nbsp;</td>\n";
476
		if ($data['type'] != "static") {
477
			echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['start']) . "{$fspane}</td>\n";
478
			echo "<td class=\"listr\">{$fspans}" . adjust_gmt($data['end']) . "{$fspane}</td>\n";
479
		} else {
480
			echo "<td class=\"listr\">{$fspans} n/a {$fspane}</td>\n";
481
			echo "<td class=\"listr\">{$fspans} n/a {$fspane}</td>\n";
482
		}
483
		echo "<td class=\"listr\">{$fspans}{$data['online']}{$fspane}</td>\n";
484
		echo "<td class=\"listr\">{$fspans}{$data['act']}{$fspane}</td>\n";
485

    
486
		if ($data['type'] == "dynamic") {
487
			echo "<td valign=\"middle\"><a href=\"services_dhcpv6_edit.php?if={$data['if']}&amp;duid={$data['duid']}&amp;hostname={$data['hostname']}\">";
488
			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";
489
		} else {
490
			echo "<td class=\"list\" valign=\"middle\">";
491
			echo "<img src=\"/themes/{$g['theme']}/images/icons/icon_plus_mo.gif\" width=\"17\" height=\"17\" border=\"0\" alt=\"add\" /></td>\n";
492
		}
493

    
494
		/* Only show the button for offline dynamic leases */
495
		if (($data['type'] == "dynamic") && ($data['online'] != "online")) {
496
			echo "<td class=\"list\" valign=\"middle\"><a href=\"status_dhcpv6_leases.php?deleteip={$data['ip']}&amp;all=" . htmlspecialchars($_GET['all']) . "\">";
497
			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";
498
		}
499
		echo "</tr>\n";
500
	}
501
}
502
?>
503
</table>
504
<br/>
505
<h3>Delegated Prefixes</h3>
506
<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="prefixes">
507
	<tr>
508
		<td class="listhdrr"><a href="#"><?=gettext("IPv6 Prefix"); ?></a></td>
509
		<td class="listhdrr"><a href="#"><?=gettext("IAID"); ?></a></td>
510
		<td class="listhdrr"><a href="#"><?=gettext("DUID"); ?></a></td>
511
		<td class="listhdrr"><a href="#"><?=gettext("Start"); ?></a></td>
512
		<td class="listhdrr"><a href="#"><?=gettext("End"); ?></a></td>
513
		<td class="listhdrr"><a href="#"><?=gettext("State"); ?></a></td>
514
	</tr>
515
<?php
516
foreach ($prefixes as $data) {
517
	if (($data['act'] == "active") || ($data['act'] == "static") || ($_GET['all'] == 1)) {
518
		if ($data['act'] != "active" && $data['act'] != "static") {
519
			$fspans = "<span class=\"gray\">";
520
			$fspane = "&nbsp;</span>";
521
		} else {
522
			$fspans = "";
523
			$fspane = "&nbsp;";
524
		}
525

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

    
579
<?php include("fend.inc"); ?>
580
</body>
581
</html>
(182-182/252)