Project

General

Profile

Download (39.4 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	services_dhcpv6.php
5
	parts of m0n0wall (http://m0n0.ch/wall)
6

    
7
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
	All rights reserved.
9

    
10
	part of pfSense (https://www.pfsense.org)
11
	Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
12
        Copyright (C) 2013-2014 Electric Sheep Fencing, LP
13
	All rights reserved.
14

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

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

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

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

    
41
##|+PRIV
42
##|*IDENT=page-services-dhcpv6server
43
##|*NAME=Services: DHCPv6 server page
44
##|*DESCR=Allow access to the 'Services: DHCPv6 server' page.
45
##|*MATCH=services_dhcpv6.php*
46
##|-PRIV
47

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

    
51
if(!$g['services_dhcp_server_enable']) {
52
	header("Location: /");
53
	exit;
54
}
55

    
56
/*  Fix failover DHCP problem
57
 *  http://article.gmane.org/gmane.comp.security.firewalls.pfsense.support/18749
58
 */
59
ini_set("memory_limit","64M");
60

    
61
$if = $_GET['if'];
62
if ($_POST['if'])
63
	$if = $_POST['if'];
64

    
65
/* if OLSRD is enabled, allow WAN to house DHCP. */
66
if($config['installedpackages']['olsrd']) {
67
	foreach($config['installedpackages']['olsrd']['config'] as $olsrd) {
68
			if($olsrd['enable']) {
69
				$is_olsr_enabled = true;
70
				break;
71
			}
72
	}
73
}
74

    
75
$iflist = get_configured_interface_with_descr();
76
$iflist = array_merge($iflist, get_configured_pppoe_server_interfaces());
77

    
78
/* set the starting interface */
79
if (!$if || !isset($iflist[$if])) {
80
	foreach ($iflist as $ifent => $ifname) {
81
		$oc = $config['interfaces'][$ifent];
82
		if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
83
			(!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))))
84
			continue;
85
		$if = $ifent;
86
		break;
87
	}
88
}
89

    
90
if (is_array($config['dhcpdv6'][$if])){
91
	/* DHCPv6 */
92
	if (is_array($config['dhcpdv6'][$if]['range'])) {
93
		$pconfig['range_from'] = $config['dhcpdv6'][$if]['range']['from'];
94
		$pconfig['range_to'] = $config['dhcpdv6'][$if]['range']['to'];
95
	}
96
	if (is_array($config['dhcpdv6'][$if]['prefixrange'])) {
97
		$pconfig['prefixrange_from'] = $config['dhcpdv6'][$if]['prefixrange']['from'];
98
		$pconfig['prefixrange_to'] = $config['dhcpdv6'][$if]['prefixrange']['to'];
99
		$pconfig['prefixrange_length'] = $config['dhcpdv6'][$if]['prefixrange']['prefixlength'];
100
	}
101
	$pconfig['deftime'] = $config['dhcpdv6'][$if]['defaultleasetime'];
102
	$pconfig['maxtime'] = $config['dhcpdv6'][$if]['maxleasetime'];
103
	$pconfig['domain'] = $config['dhcpdv6'][$if]['domain'];
104
	$pconfig['domainsearchlist'] = $config['dhcpdv6'][$if]['domainsearchlist'];
105
	list($pconfig['wins1'],$pconfig['wins2']) = $config['dhcpdv6'][$if]['winsserver'];
106
	list($pconfig['dns1'],$pconfig['dns2'],$pconfig['dns3'],$pconfig['dns4']) = $config['dhcpdv6'][$if]['dnsserver'];
107
	$pconfig['enable'] = isset($config['dhcpdv6'][$if]['enable']);
108
	$pconfig['ddnsdomain'] = $config['dhcpdv6'][$if]['ddnsdomain'];
109
	$pconfig['ddnsdomainprimary'] = $config['dhcpdv6'][$if]['ddnsdomainprimary'];
110
	$pconfig['ddnsdomainkeyname'] = $config['dhcpdv6'][$if]['ddnsdomainkeyname'];
111
	$pconfig['ddnsdomainkey'] = $config['dhcpdv6'][$if]['ddnsdomainkey'];
112
	$pconfig['ddnsupdate'] = isset($config['dhcpdv6'][$if]['ddnsupdate']);
113
	list($pconfig['ntp1'],$pconfig['ntp2']) = $config['dhcpdv6'][$if]['ntpserver'];
114
	$pconfig['tftp'] = $config['dhcpdv6'][$if]['tftp'];
115
	$pconfig['ldap'] = $config['dhcpdv6'][$if]['ldap'];
116
	$pconfig['netboot'] = isset($config['dhcpdv6'][$if]['netboot']);
117
	$pconfig['bootfile_url'] = $config['dhcpdv6'][$if]['bootfile_url'];
118
	$pconfig['netmask'] = $config['dhcpdv6'][$if]['netmask'];
119
	$pconfig['numberoptions'] = $config['dhcpdv6'][$if]['numberoptions'];
120
	$pconfig['dhcpv6leaseinlocaltime'] = $config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'];
121
	if (!is_array($config['dhcpdv6'][$if]['staticmap']))
122
		$config['dhcpdv6'][$if]['staticmap'] = array();
123
	$a_maps = &$config['dhcpdv6'][$if]['staticmap'];
124
}
125

    
126
$ifcfgip = get_interface_ipv6($if);
127
$ifcfgsn = get_interface_subnetv6($if);
128

    
129
/*   set the enabled flag which will tell us if DHCP relay is enabled
130
 *   on any interface. We will use this to disable DHCP server since
131
 *   the two are not compatible with each other.
132
 */
133

    
134
$dhcrelay_enabled = false;
135
$dhcrelaycfg = $config['dhcrelay6'];
136

    
137
if(is_array($dhcrelaycfg)) {
138
	foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) {
139
		if (isset($dhcrelayifconf['enable']) && isset($iflist[$dhcrelayif]) &&
140
			(!link_interface_to_bridge($dhcrelayif)))
141
			$dhcrelay_enabled = true;
142
	}
143
}
144

    
145
if ($_POST) {
146

    
147
	unset($input_errors);
148

    
149
	$old_dhcpdv6_enable = ($pconfig['enable'] == true);
150
	$new_dhcpdv6_enable = ($_POST['enable'] ? true : false);
151
	$dhcpdv6_enable_changed = ($old_dhcpdv6_enable != $new_dhcpdv6_enable);
152

    
153
	$pconfig = $_POST;
154

    
155
	$numberoptions = array();
156
	for($x=0; $x<99; $x++) {
157
		if(isset($_POST["number{$x}"]) && ctype_digit($_POST["number{$x}"])) {
158
			$numbervalue = array();
159
			$numbervalue['number'] = htmlspecialchars($_POST["number{$x}"]);
160
			$numbervalue['value'] = htmlspecialchars($_POST["value{$x}"]);
161
			$numberoptions['item'][] = $numbervalue;
162
		}
163
	}
164
	// Reload the new pconfig variable that the forum uses.
165
	$pconfig['numberoptions'] = $numberoptions;
166

    
167
	/* input validation */
168
	if ($_POST['enable']) {
169
		$reqdfields = explode(" ", "range_from range_to");
170
		$reqdfieldsn = array(gettext("Range begin"),gettext("Range end"));
171

    
172
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
173

    
174
		if (($_POST['prefixrange_from'] && !is_ipaddrv6($_POST['prefixrange_from'])))
175
			$input_errors[] = gettext("A valid range must be specified.");
176
		if (($_POST['prefixrange_to'] && !is_ipaddrv6($_POST['prefixrange_to'])))
177
			$input_errors[] = gettext("A valid prefix range must be specified.");
178
		if (($_POST['range_from'] && !is_ipaddrv6($_POST['range_from'])))
179
			$input_errors[] = gettext("A valid range must be specified.");
180
		if (($_POST['range_to'] && !is_ipaddrv6($_POST['range_to'])))
181
			$input_errors[] = gettext("A valid range must be specified.");
182
		if (($_POST['gateway'] && !is_ipaddrv6($_POST['gateway'])))
183
			$input_errors[] = gettext("A valid IPv6 address must be specified for the gateway.");
184
		if (($_POST['dns1'] && !is_ipaddrv6($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddrv6($_POST['dns2'])) || ($_POST['dns3'] && !is_ipaddrv6($_POST['dns3'])) || ($_POST['dns4'] && !is_ipaddrv6($_POST['dns4'])))
185
			$input_errors[] = gettext("A valid IPv6 address must be specified for each of the DNS servers.");
186

    
187
		if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60)))
188
			$input_errors[] = gettext("The default lease time must be at least 60 seconds.");
189
		if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime'])))
190
			$input_errors[] = gettext("The maximum lease time must be at least 60 seconds and higher than the default lease time.");
191
		if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain'])))
192
			$input_errors[] = gettext("A valid domain name must be specified for the dynamic DNS registration.");
193
		if (($_POST['ddnsdomain'] && !is_ipaddrv4($_POST['ddnsdomainprimary'])))
194
			$input_errors[] = gettext("A valid primary domain name server IPv4 address must be specified for the dynamic domain name.");
195
		if (($_POST['ddnsdomainkey'] && !$_POST['ddnsdomainkeyname']) ||
196
			($_POST['ddnsdomainkeyname'] && !$_POST['ddnsdomainkey']))
197
			$input_errors[] = gettext("You must specify both a valid domain key and key name.");
198
		if ($_POST['domainsearchlist']) {
199
			$domain_array=preg_split("/[ ;]+/",$_POST['domainsearchlist']);
200
			foreach ($domain_array as $curdomain) {
201
				if (!is_domain($curdomain)) {
202
					$input_errors[] = gettext("A valid domain search list must be specified.");
203
					break;
204
				}
205
			}
206
		}
207

    
208
		if (($_POST['ntp1'] && !is_ipaddrv6($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddrv6($_POST['ntp2'])))
209
			$input_errors[] = gettext("A valid IPv6 address must be specified for the primary/secondary NTP servers.");
210
		if (($_POST['domain'] && !is_domain($_POST['domain'])))
211
			$input_errors[] = gettext("A valid domain name must be specified for the DNS domain.");
212
		if ($_POST['tftp'] && !is_ipaddr($_POST['tftp']) && !is_domain($_POST['tftp']) && !is_URL($_POST['tftp']))
213
			$input_errors[] = gettext("A valid IPv6 address or hostname must be specified for the TFTP server.");
214
		if (($_POST['bootfile_url'] && !is_URL($_POST['bootfile_url'])))
215
			$input_errors[] = gettext("A valid URL must be specified for the network bootfile.");
216

    
217
		// Disallow a range that includes the virtualip
218
		if (is_array($config['virtualip']['vip'])) {
219
			foreach($config['virtualip']['vip'] as $vip) {
220
				if($vip['interface'] == $if)
221
					if($vip['subnetv6'] && is_inrange_v6($vip['subnetv6'], $_POST['range_from'], $_POST['range_to']))
222
						$input_errors[] = sprintf(gettext("The subnet range cannot overlap with virtual IPv6 address %s."),$vip['subnetv6']);
223
			}
224
		}
225

    
226
		$noip = false;
227
		if(is_array($a_maps))
228
			foreach ($a_maps as $map)
229
				if (empty($map['ipaddrv6']))
230
					$noip = true;
231
		if (!$input_errors) {
232
			/* make sure the range lies within the current subnet */
233
			$subnet_start = gen_subnetv6($ifcfgip, $ifcfgsn);
234
			$subnet_end = gen_subnetv6_max($ifcfgip, $ifcfgsn);
235

    
236
			if (is_ipaddrv6($ifcfgip)) {
237
				if ((! is_inrange_v6($_POST['range_from'], $subnet_start, $subnet_end)) ||
238
			   	 (! is_inrange_v6($_POST['range_to'], $subnet_start, $subnet_end))) {
239
					$input_errors[] = gettext("The specified range lies outside of the current subnet.");
240
				}
241
			}
242
			/* "from" cannot be higher than "to" */
243
			if (inet_pton($_POST['range_from']) > inet_pton($_POST['range_to']))
244
				$input_errors[] = gettext("The range is invalid (first element higher than second element).");
245

    
246
			/* make sure that the DHCP Relay isn't enabled on this interface */
247
			if (isset($config['dhcrelay'][$if]['enable']))
248
				$input_errors[] = sprintf(gettext("You must disable the DHCP relay on the %s interface before enabling the DHCP server."),$iflist[$if]);
249

    
250

    
251
			/* Verify static mappings do not overlap:
252
			   - available DHCP range
253
			   - prefix delegation range (FIXME: still need to be completed) */
254
			$dynsubnet_start = inet_pton($_POST['range_from']);
255
			$dynsubnet_end = inet_pton($_POST['range_to']);
256

    
257
			if(is_array($a_maps)) {
258
				foreach ($a_maps as $map) {
259
					if (empty($map['ipaddrv6']))
260
						continue;
261
					if ((inet_pton($map['ipaddrv6']) > $dynsubnet_start) &&
262
						(inet_pton($map['ipaddrv6']) < $dynsubnet_end)) {
263
						$input_errors[] = sprintf(gettext("The DHCP range cannot overlap any static DHCP mappings."));
264
						break;
265
					}
266
				}
267
			}
268
		}
269
	}
270

    
271
	if (!$input_errors) {
272
		if (!is_array($config['dhcpdv6'][$if]))
273
			$config['dhcpdv6'][$if] = array();
274
		if (!is_array($config['dhcpdv6'][$if]['range']))
275
			$config['dhcpdv6'][$if]['range'] = array();
276
		if (!is_array($config['dhcpdv6'][$if]['prefixrange']))
277
			$config['dhcpdv6'][$if]['prefixrange'] = array();
278

    
279
		$config['dhcpdv6'][$if]['range']['from'] = $_POST['range_from'];
280
		$config['dhcpdv6'][$if]['range']['to'] = $_POST['range_to'];
281
		$config['dhcpdv6'][$if]['prefixrange']['from'] = $_POST['prefixrange_from'];
282
		$config['dhcpdv6'][$if]['prefixrange']['to'] = $_POST['prefixrange_to'];
283
		$config['dhcpdv6'][$if]['prefixrange']['prefixlength'] = $_POST['prefixrange_length'];
284
		$config['dhcpdv6'][$if]['defaultleasetime'] = $_POST['deftime'];
285
		$config['dhcpdv6'][$if]['maxleasetime'] = $_POST['maxtime'];
286
		$config['dhcpdv6'][$if]['netmask'] = $_POST['netmask'];
287

    
288
		unset($config['dhcpdv6'][$if]['winsserver']);
289

    
290
		unset($config['dhcpdv6'][$if]['dnsserver']);
291
		if ($_POST['dns1'])
292
			$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns1'];
293
		if ($_POST['dns2'])
294
			$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns2'];
295
		if ($_POST['dns3'])
296
			$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns3'];
297
		if ($_POST['dns4'])
298
			$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns4'];
299

    
300
		$config['dhcpdv6'][$if]['domain'] = $_POST['domain'];
301
		$config['dhcpdv6'][$if]['domainsearchlist'] = $_POST['domainsearchlist'];
302
		$config['dhcpdv6'][$if]['enable'] = ($_POST['enable']) ? true : false;
303
		$config['dhcpdv6'][$if]['ddnsdomain'] = $_POST['ddnsdomain'];
304
		$config['dhcpdv6'][$if]['ddnsdomainprimary'] = $_POST['ddnsdomainprimary'];
305
		$config['dhcpdv6'][$if]['ddnsdomainkeyname'] = $_POST['ddnsdomainkeyname'];
306
		$config['dhcpdv6'][$if]['ddnsdomainkey'] = $_POST['ddnsdomainkey'];
307
		$config['dhcpdv6'][$if]['ddnsupdate'] = ($_POST['ddnsupdate']) ? true : false;
308

    
309
		unset($config['dhcpdv6'][$if]['ntpserver']);
310
		if ($_POST['ntp1'])
311
			$config['dhcpdv6'][$if]['ntpserver'][] = $_POST['ntp1'];
312
		if ($_POST['ntp2'])
313
			$config['dhcpdv6'][$if]['ntpserver'][] = $_POST['ntp2'];
314

    
315
		$config['dhcpdv6'][$if]['tftp'] = $_POST['tftp'];
316
		$config['dhcpdv6'][$if]['ldap'] = $_POST['ldap'];
317
		$config['dhcpdv6'][$if]['netboot'] = ($_POST['netboot']) ? true : false;
318
		$config['dhcpdv6'][$if]['bootfile_url'] = $_POST['bootfile_url'];
319
		$config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'] = $_POST['dhcpv6leaseinlocaltime'];
320

    
321
		// Handle the custom options rowhelper
322
		if(isset($config['dhcpdv6'][$if]['numberoptions']['item']))
323
			unset($config['dhcpdv6'][$if]['numberoptions']['item']);
324

    
325
		$config['dhcpdv6'][$if]['numberoptions'] = $numberoptions;
326

    
327
		write_config();
328

    
329
		$retval = 0;
330
		$retvaldhcp = 0;
331
		$retvaldns = 0;
332
		/* Stop DHCPv6 so we can cleanup leases */
333
		killbypid("{$g['dhcpd_chroot_path']}{$g['varrun_path']}/dhcpdv6.pid");
334
		// dhcp_clean_leases();
335
		/* dnsmasq_configure calls dhcpd_configure */
336
		/* no need to restart dhcpd twice */
337
		if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic']))	{
338
			$retvaldns = services_dnsmasq_configure();
339
			if ($retvaldns == 0) {
340
				clear_subsystem_dirty('hosts');
341
				clear_subsystem_dirty('staticmaps');
342
			}
343
		} else if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
344
			$retvaldns = services_unbound_configure();
345
			if ($retvaldns == 0)
346
				clear_subsystem_dirty('unbound');
347
		} else {
348
			$retvaldhcp = services_dhcpd_configure();
349
			if ($retvaldhcp == 0)
350
				clear_subsystem_dirty('staticmaps');
351
		}
352
		if ($dhcpdv6_enable_changed)
353
			$retvalfc = filter_configure();
354
		if($retvaldhcp == 1 || $retvaldns == 1 || $retvalfc == 1)
355
			$retval = 1;
356
		$savemsg = get_std_save_message($retval);
357
	}
358
}
359

    
360
if ($_GET['act'] == "del") {
361
	if ($a_maps[$_GET['id']]) {
362
		unset($a_maps[$_GET['id']]);
363
		write_config();
364
		if(isset($config['dhcpdv6'][$if]['enable'])) {
365
			mark_subsystem_dirty('staticmapsv6');
366
			if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstaticv6']))
367
				mark_subsystem_dirty('hosts');
368
		}
369
		header("Location: services_dhcpv6.php?if={$if}");
370
		exit;
371
	}
372
}
373

    
374
$closehead = false;
375
$pgtitle = array(gettext("Services"),gettext("DHCPv6 server"));
376
$shortcut_section = "dhcp6";
377

    
378
include("head.inc");
379

    
380
?>
381

    
382
<script type="text/javascript" src="/javascript/row_helper.js">
383
</script>
384

    
385
<script type="text/javascript">
386
//<![CDATA[
387
	rowname[0] = "number";
388
	rowtype[0] = "textbox";
389
	rowsize[0] = "10";
390
	rowname[1] = "value";
391
	rowtype[1] = "textbox";
392
	rowsize[1] = "55";
393
//]]>
394
</script>
395

    
396
<script type="text/javascript">
397
//<![CDATA[
398
	function enable_change(enable_over) {
399
		var endis;
400
		endis = !(document.iform.enable.checked || enable_over);
401
		document.iform.range_from.disabled = endis;
402
		document.iform.range_to.disabled = endis;
403
		document.iform.prefixrange_from.disabled = endis;
404
		document.iform.prefixrange_to.disabled = endis;
405
		document.iform.prefixrange_length.disabled = endis;
406
		document.iform.dns1.disabled = endis;
407
		document.iform.dns2.disabled = endis;
408
		document.iform.dns3.disabled = endis;
409
		document.iform.dns4.disabled = endis;
410
		document.iform.deftime.disabled = endis;
411
		document.iform.maxtime.disabled = endis;
412
		//document.iform.gateway.disabled = endis;
413
		document.iform.dhcpv6leaseinlocaltime.disabled = endis;
414
		document.iform.domain.disabled = endis;
415
		document.iform.domainsearchlist.disabled = endis;
416
		document.iform.ddnsdomain.disabled = endis;
417
		document.iform.ddnsdomainprimary.disabled = endis;
418
		document.iform.ddnsdomainkeyname.disabled = endis;
419
		document.iform.ddnsdomainkey.disabled = endis;
420
		document.iform.ddnsupdate.disabled = endis;
421
		document.iform.ntp1.disabled = endis;
422
		document.iform.ntp2.disabled = endis;
423
		//document.iform.tftp.disabled = endis;
424
		document.iform.ldap.disabled = endis;
425
		document.iform.netboot.disabled = endis;
426
		document.iform.bootfile_url.disabled = endis;
427
	}
428

    
429
	function show_shownumbervalue() {
430
		document.getElementById("shownumbervaluebox").innerHTML='';
431
		aodiv = document.getElementById('shownumbervalue');
432
		aodiv.style.display = "block";
433
	}
434

    
435
	function show_ddns_config() {
436
		document.getElementById("showddnsbox").innerHTML='';
437
		aodiv = document.getElementById('showddns');
438
		aodiv.style.display = "block";
439
	}
440
	function show_ntp_config() {
441
		document.getElementById("showntpbox").innerHTML='';
442
		aodiv = document.getElementById('showntp');
443
		aodiv.style.display = "block";
444
	}
445
	/*
446
	function show_tftp_config() {
447
		document.getElementById("showtftpbox").innerHTML='';
448
		aodiv = document.getElementById('showtftp');
449
		aodiv.style.display = "block";
450
	}
451
	*/
452
	function show_ldap_config() {
453
		document.getElementById("showldapbox").innerHTML='';
454
		aodiv = document.getElementById('showldap');
455
		aodiv.style.display = "block";
456
	}
457

    
458
	function show_netboot_config() {
459
		document.getElementById("shownetbootbox").innerHTML='';
460
		aodiv = document.getElementById('shownetboot');
461
		aodiv.style.display = "block";
462
	}
463
//]]>
464
</script>
465
</head>
466

    
467
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
468
<?php include("fbegin.inc"); ?>
469
<form action="services_dhcpv6.php" method="post" name="iform" id="iform">
470
<?php if ($input_errors) print_input_errors($input_errors); ?>
471
<?php if ($savemsg) print_info_box($savemsg); ?>
472
<?php
473
	if ($dhcrelay_enabled) {
474
		echo gettext("DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.");
475
		include("fend.inc");
476
		echo "</body>";
477
		echo "</html>";
478
		exit;
479
	}
480
?>
481
<?php if (is_subsystem_dirty('staticmaps')): ?><p>
482
<?php print_info_box_np(gettext("The static mapping configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
483
<?php endif; ?>
484
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="dhcpv6 server">
485
<tr><td>
486
<?php
487
	/* active tabs */
488
	$tab_array = array();
489
	$tabscounter = 0;
490
	$i = 0;
491
	foreach ($iflist as $ifent => $ifname) {
492
		$oc = $config['interfaces'][$ifent];
493
		if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
494
			(!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))))
495
			continue;
496
		if ($ifent == $if)
497
			$active = true;
498
		else
499
			$active = false;
500
		$tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}");
501
		$tabscounter++;
502
	}
503
	/* tack on PPPoE or PPtP servers here */
504
	/* pppoe server */
505
	if (is_array($config['pppoes']['pppoe'])) {
506
		foreach($config['pppoes']['pppoe'] as $pppoe) {
507
			if ($pppoe['mode'] == "server") {
508
				$ifent = "poes". $pppoe['pppoeid'];
509
				$ifname = strtoupper($ifent);
510
				if ($ifent == $if)
511
					$active = true;
512
				else
513
					$active = false;
514
				$tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}");
515
				$tabscounter++;
516
			}
517
		}
518
	}
519
	if ($tabscounter == 0) {
520
		echo "<b>" . gettext("The DHCPv6 Server can only be enabled on interfaces configured with a static IPv6 address. This system has none.") . "<br/><br/>";
521
		echo "</td></tr></table></form>";
522
		include("fend.inc");
523
		echo "</body>";
524
		echo "</html>";
525
		exit;
526
	}
527
	display_top_tabs($tab_array);
528
?>
529
</td></tr>
530
<tr><td class="tabnavtbl">
531
<?php
532
$tab_array = array();
533
$tab_array[] = array(gettext("DHCPv6 Server"),         true,  "services_dhcpv6.php?if={$if}");
534
$tab_array[] = array(gettext("Router Advertisements"), false, "services_router_advertisements.php?if={$if}");
535
display_top_tabs($tab_array);
536
?>
537
</td></tr>
538
<tr>
539
<td>
540
	<div id="mainarea">
541
		<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
542
		<tr>
543
			<td width="22%" valign="top" class="vncellreq"><?=gettext("DHCPv6 Server");?></td>
544
			<td width="78%" class="vtable">
545
				<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onclick="enable_change(false);" />
546
			<strong><?php printf(gettext("Enable DHCPv6 server on " .
547
			"%s " .
548
			"interface"),htmlspecialchars($iflist[$if]));?></strong></td>
549
			</tr>
550
			<?php
551
			/* the PPPoE Server could well have no IPv6 address and operate fine with just link-local, just hide these */
552
			if(is_ipaddrv6($ifcfgip)) {
553
			?>
554
			<tr>
555
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet");?></td>
556
			<td width="78%" class="vtable">
557
				<?=gen_subnetv6($ifcfgip, $ifcfgsn);?>
558
			</td>
559
			</tr>
560
			<tr>
561
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet mask");?></td>
562
			<td width="78%" class="vtable">
563
				<?=$ifcfgsn;?> bits
564
			</td>
565
			</tr>
566
			<tr>
567
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Available range");?></td>
568
			<td width="78%" class="vtable">
569
			<?php
570
				$range_from = gen_subnetv6($ifcfgip, $ifcfgsn);
571
				$range_from++;
572
				echo $range_from;
573

    
574
			?>
575
			-
576
			<?php
577
				$range_to = gen_subnetv6_max($ifcfgip, $ifcfgsn);
578
				echo $range_to;
579
			?>
580
			</td>
581
			</tr>
582
			<?php } ?>
583

    
584
			<?php if($is_olsr_enabled): ?>
585
			<tr>
586
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet Mask");?></td>
587
			<td width="78%" class="vtable">
588
				<select name="netmask" class="formselect" id="netmask">
589
				<?php
590
				for ($i = 128; $i > 0; $i--) {
591
					if($i <> 127) {
592
						echo "<option value=\"{$i}\" ";
593
						if ($i == $pconfig['netmask']) echo "selected";
594
						echo ">" . $i . "</option>";
595
					}
596
				}
597
				?>
598
				</select>
599
			</td>
600
			</tr>
601
			<?php endif; ?>
602
			<tr>
603
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Range");?></td>
604
			<td width="78%" class="vtable">
605
				<input name="range_from" type="text" class="formfld unknown" id="range_from" size="28" value="<?=htmlspecialchars($pconfig['range_from']);?>" />
606
				&nbsp;<?=gettext("to"); ?>&nbsp; <input name="range_to" type="text" class="formfld unknown" id="range_to" size="28" value="<?=htmlspecialchars($pconfig['range_to']);?>" />
607
			</td>
608
			</tr>
609
			<tr>
610
			<td width="22%" valign="top" class="vncell"><?=gettext("Prefix Delegation Range");?></td>
611
			<td width="78%" class="vtable">
612
				<input name="prefixrange_from" type="text" class="formfld unknown" id="prefixrange_from" size="28" value="<?=htmlspecialchars($pconfig['prefixrange_from']);?>" />
613
				&nbsp;<?=gettext("to"); ?>&nbsp; <input name="prefixrange_to" type="text" class="formfld unknown" id="prefixrange_to" size="28" value="<?=htmlspecialchars($pconfig['prefixrange_to']);?>" />
614
				&nbsp;<br /><?=gettext("Prefix Delegation Size"); ?>:&nbsp; <select name="prefixrange_length" class="formselect" id="prefixrange_length">
615
					<option value="48" <?php if($pconfig['prefixrange_length'] == 48) echo "selected=\"selected\""; ?>>48</option>
616
					<option value="52" <?php if($pconfig['prefixrange_length'] == 52) echo "selected=\"selected\""; ?>>52</option>
617
					<option value="56" <?php if($pconfig['prefixrange_length'] == 56) echo "selected=\"selected\""; ?>>56</option>
618
					<option value="60" <?php if($pconfig['prefixrange_length'] == 60) echo "selected=\"selected\""; ?>>60</option>
619
					<option value="62" <?php if($pconfig['prefixrange_length'] == 62) echo "selected=\"selected\""; ?>>62</option>
620
					<option value="63" <?php if($pconfig['prefixrange_length'] == 63) echo "selected=\"selected\""; ?>>63</option>
621
					<option value="64" <?php if($pconfig['prefixrange_length'] == 64) echo "selected=\"selected\""; ?>>64</option>
622
				</select> <br />
623
				<?php echo gettext("You can define a Prefix range here for DHCP Prefix Delegation. This allows for 
624
					assigning networks to subrouters. The start and end of the range must end on boundaries of the prefix delegation size."); ?>
625
			</td>
626
			</tr>
627
			<tr>
628
			<td width="22%" valign="top" class="vncell"><?=gettext("DNS servers");?></td>
629
			<td width="78%" class="vtable">
630
				<input name="dns1" type="text" class="formfld unknown" id="dns1" size="28" value="<?=htmlspecialchars($pconfig['dns1']);?>" /><br />
631
				<input name="dns2" type="text" class="formfld unknown" id="dns2" size="28" value="<?=htmlspecialchars($pconfig['dns2']);?>" /><br />
632
				<input name="dns3" type="text" class="formfld unknown" id="dns3" size="28" value="<?=htmlspecialchars($pconfig['dns3']);?>" /><br />
633
				<input name="dns4" type="text" class="formfld unknown" id="dns4" size="28" value="<?=htmlspecialchars($pconfig['dns4']);?>" /><br />
634
				<?=gettext("NOTE: leave blank to use the system default DNS servers - this interface's IP if DNS forwarder is enabled, otherwise the servers configured on the General page.");?>
635
			</td>
636
			</tr>
637
			<tr>
638
			<td width="22%" valign="top" class="vncell"><?=gettext("Domain name");?></td>
639
			<td width="78%" class="vtable">
640
				<input name="domain" type="text" class="formfld unknown" id="domain" size="28" value="<?=htmlspecialchars($pconfig['domain']);?>" /><br />
641
				 <?=gettext("The default is to use the domain name of this system as the default domain name provided by DHCP. You may specify an alternate domain name here.");?>
642
			 </td>
643
			</tr>
644
			<tr>
645
			<td width="22%" valign="top" class="vncell"><?=gettext("Domain search list");?></td>
646
			<td width="78%" class="vtable">
647
				<input name="domainsearchlist" type="text" class="formfld unknown" id="domainsearchlist" size="28" value="<?=htmlspecialchars($pconfig['domainsearchlist']);?>" /><br />
648
				<?=gettext("The DHCP server can optionally provide a domain search list. Use the semicolon character as separator");?>
649
			</td>
650
			</tr>
651
			<tr>
652
			<td width="22%" valign="top" class="vncell"><?=gettext("Default lease time");?></td>
653
			<td width="78%" class="vtable">
654
				<input name="deftime" type="text" class="formfld unknown" id="deftime" size="10" value="<?=htmlspecialchars($pconfig['deftime']);?>" />
655
				<?=gettext("seconds");?><br />
656
				<?=gettext("This is used for clients that do not ask for a specific " .
657
				"expiration time."); ?><br />
658
				<?=gettext("The default is 7200 seconds.");?>
659
			</td>
660
			</tr>
661
			<tr>
662
			<td width="22%" valign="top" class="vncell"><?=gettext("Maximum lease time");?></td>
663
			<td width="78%" class="vtable">
664
				<input name="maxtime" type="text" class="formfld unknown" id="maxtime" size="10" value="<?=htmlspecialchars($pconfig['maxtime']);?>" />
665
				<?=gettext("seconds");?><br />
666
				<?=gettext("This is the maximum lease time for clients that ask".
667
				" for a specific expiration time."); ?><br />
668
				<?=gettext("The default is 86400 seconds.");?>
669
			</td>
670
			</tr>
671
			<tr>
672
				<td width="22%" valign="top" class="vncell"><?=gettext("Time format change"); ?></td>
673
				<td width="78%" class="vtable">
674
				<table summary="time format change">
675
					<tr>
676
					<td>
677
						<input name="dhcpv6leaseinlocaltime" type="checkbox" id="dhcpv6leaseinlocaltime" value="yes" <?php if ($pconfig['dhcpv6leaseinlocaltime']) echo "checked=\"checked\""; ?> />
678
					</td>
679
					<td>
680
						<strong>
681
							<?=gettext("Change DHCPv6 display lease time from UTC to local time."); ?>
682
						</strong>
683
					</td>
684
					</tr>
685
					<tr>
686
					<td>&nbsp;</td>
687
					<td>
688
						<span class="red"><strong><?=gettext("Note:");?></strong></span> <?=gettext("By default DHCPv6 leases are displayed in UTC time.  By checking this 
689
						box DHCPv6 lease time will be displayed in local time and set to time zone selected.  This will be used for all DHCPv6 interfaces lease time."); ?>
690
					
691
					</td>
692
					</tr>
693
				</table>
694
				</td>
695
			</tr>
696
			<tr>
697
			<td width="22%" valign="top" class="vncell"><?=gettext("Dynamic DNS");?></td>
698
			<td width="78%" class="vtable">
699
				<div id="showddnsbox">
700
					<input type="button" onclick="show_ddns_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Dynamic DNS");?>
701
				</div>
702
				<div id="showddns" style="display:none">
703
					<input style="vertical-align:middle" type="checkbox" value="yes" name="ddnsupdate" id="ddnsupdate" <?php if($pconfig['ddnsupdate']) echo " checked=\"checked\""; ?> />&nbsp;
704
					<b><?=gettext("Enable registration of DHCP client names in DNS.");?></b><br />
705
					<p>
706
					<input name="ddnsdomain" type="text" class="formfld unknown" id="ddnsdomain" size="28" value="<?=htmlspecialchars($pconfig['ddnsdomain']);?>" /><br />
707
					<?=gettext("Note: Leave blank to disable dynamic DNS registration.");?><br />
708
					<?=gettext("Enter the dynamic DNS domain which will be used to register client names in the DNS server.");?><br />
709
					<input name="ddnsdomainprimary" type="text" class="formfld unknown" id="ddnsdomainprimary" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainprimary']);?>" /><br />
710
					<?=gettext("Enter the primary domain name server IP address for the dynamic domain name.");?><br />
711
					<input name="ddnsdomainkeyname" type="text" class="formfld unknown" id="ddnsdomainkeyname" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainkeyname']);?>" /><br />
712
					<?=gettext("Enter the dynamic DNS domain key name which will be used to register client names in the DNS server.");?><br />
713
					<input name="ddnsdomainkey" type="text" class="formfld unknown" id="ddnsdomainkey" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainkey']);?>" /><br />
714
					<?=gettext("Enter the dynamic DNS domain key secret which will be used to register client names in the DNS server.");?>
715
					</p>
716
				</div>
717
			</td>
718
			</tr>
719
			<tr>
720
			<td width="22%" valign="top" class="vncell"><?=gettext("NTP servers");?></td>
721
			<td width="78%" class="vtable">
722
				<div id="showntpbox">
723
					<input type="button" onclick="show_ntp_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show NTP configuration");?>
724
				</div>
725
				<div id="showntp" style="display:none">
726
					<input name="ntp1" type="text" class="formfld unknown" id="ntp1" size="28" value="<?=htmlspecialchars($pconfig['ntp1']);?>" /><br />
727
					<input name="ntp2" type="text" class="formfld unknown" id="ntp2" size="28" value="<?=htmlspecialchars($pconfig['ntp2']);?>" />
728
				</div>
729
			</td>
730
			</tr>
731
			<!-- ISC dhcpd does not support tftp for ipv6 yet. See redmine #2016
732
			<tr>
733
			<td width="22%" valign="top" class="vncell"><?=gettext("TFTP server");?></td>
734
			<td width="78%" class="vtable">
735
			<div id="showtftpbox">
736
				<input type="button" onclick="show_tftp_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show TFTP configuration");?>
737
			</div>
738
			<div id="showtftp" style="display:none">
739
				<input name="tftp" type="text" class="formfld unknown" id="tftp" size="50" value="<?=htmlspecialchars($pconfig['tftp']);?>" /><br />
740
				<?=gettext("Leave blank to disable.  Enter a full hostname or IP for the TFTP server.");?>
741
			</div>
742
			</td>
743
			</tr>
744
			-->
745
			<tr>
746
			<td width="22%" valign="top" class="vncell"><?=gettext("LDAP URI");?></td>
747
			<td width="78%" class="vtable">
748
				<div id="showldapbox">
749
					<input type="button" onclick="show_ldap_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show LDAP configuration");?>
750
				</div>
751
				<div id="showldap" style="display:none">
752
					<input name="ldap" type="text" class="formfld unknown" id="ldap" size="80" value="<?=htmlspecialchars($pconfig['ldap']);?>" /><br />
753
					<?=gettext("Leave blank to disable.  Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com");?>
754
				</div>
755
			</td>
756
			</tr>
757
			<tr>
758
			<td width="22%" valign="top" class="vncell"><?=gettext("Enable network booting");?></td>
759
			<td width="78%" class="vtable">
760
				<div id="shownetbootbox">
761
					<input type="button" onclick="show_netboot_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Network booting");?>
762
				</div>
763
				<div id="shownetboot" style="display:none">
764
					<input style="vertical-align:middle" type="checkbox" value="yes" name="netboot" id="netboot" <?php if($pconfig['netboot']) echo " checked=\"checked\""; ?> />&nbsp;
765
					<b><?=gettext("Enables network booting.");?></b>
766
					<br/>
767
					<?=gettext("Enter the Bootfile URL");?>
768
					<input name="bootfile_url" type="text" class="formfld unknown" id="bootfile_url" size="28" value="<?=htmlspecialchars($pconfig['bootfile_url']);?>" />
769
				</div>
770
			</td>
771
			</tr>
772
			<tr>
773
			<td width="22%" valign="top" class="vncell"><?=gettext("Additional BOOTP/DHCP Options");?></td>
774
			<td width="78%" class="vtable">
775
				<div id="shownumbervaluebox">
776
					<input type="button" onclick="show_shownumbervalue()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Additional BOOTP/DHCP Options");?>
777
				</div>
778
				<div id="shownumbervalue" style="display:none">
779
				<table id="maintable" summary="bootp-dhcp options">
780
				<tbody>
781
				<tr>
782
				<td colspan="3">
783
					<div style="padding:5px; margin-top: 16px; margin-bottom: 16px; border:1px dashed #000066; background-color: #ffffff; color: #000000; font-size: 8pt;" id="itemhelp">
784
					<?=gettext("Enter the DHCP option number and the value for each item you would like to include in the DHCP lease information.  For a list of available options please visit this"); ?> <a href="http://www.iana.org/assignments/bootp-dhcp-parameters/" target="_blank"><?=gettext("URL"); ?></a>
785
					</div>
786
				</td>
787
				</tr>
788
				<tr>
789
				<td><div id="onecolumn"><?=gettext("Number");?></div></td>
790
				<td><div id="twocolumn"><?=gettext("Value");?></div></td>
791
				</tr>
792
				<?php $counter = 0; ?>
793
				<?php
794
					if($pconfig['numberoptions'])
795
						foreach($pconfig['numberoptions']['item'] as $item):
796
				?>
797
					<?php
798
						$number = $item['number'];
799
						$value = $item['value'];
800
					?>
801
				<tr>
802
				<td>
803
					<input autocomplete="off" name="number<?php echo $counter; ?>" type="text" class="formfld" id="number<?php echo $counter; ?>" size="10" value="<?=htmlspecialchars($number);?>" />
804
				</td>
805
				<td>
806
					<input autocomplete="off" name="value<?php echo $counter; ?>" type="text" class="formfld" id="value<?php echo $counter; ?>" size="55" value="<?=htmlspecialchars($value);?>" />
807
				</td>
808
				<td>
809
					<input type="image" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" onclick="removeRow(this); return false;" value="<?=gettext("Delete");?>" />
810
				</td>
811
				</tr>
812
				<?php $counter++; ?>
813
				<?php endforeach; ?>
814
				</tbody>
815
				</table>
816
				<a onclick="javascript:addRowTo('maintable', 'formfldalias'); return false;" href="#">
817
					<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="<?=gettext("add another entry");?>" />
818
				</a>
819
				<script type="text/javascript">
820
				//<![CDATA[
821
					field_counter_js = 2;
822
					rows = 1;
823
					totalrows = <?php echo $counter; ?>;
824
					loaded = <?php echo $counter; ?>;
825
				//]]>
826
				</script>
827
				</div>
828

    
829
				</td>
830
			</tr>
831
			<tr>
832
			<td width="22%" valign="top">&nbsp;</td>
833
			<td width="78%">
834
				<input name="if" type="hidden" value="<?=$if;?>" />
835
				<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="enable_change(true)" />
836
			</td>
837
			</tr>
838
			<tr>
839
			<td width="22%" valign="top">&nbsp;</td>
840
			<td width="78%"> <p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br />
841
				</strong></span><?=gettext("The DNS servers entered in"); ?> <a href="system.php"><?=gettext("System: " .
842
				"General setup"); ?></a> <?=gettext("(or the"); ?> <a href="services_dnsmasq.php"><?=gettext("DNS " .
843
				"forwarder"); ?></a>, <?=gettext("if enabled)"); ?> </span><span class="vexpl"><?=gettext("will " .
844
				"be assigned to clients by the DHCP server."); ?><br />
845
				<br />
846
				<?=gettext("The DHCP lease table can be viewed on the"); ?> <a href="status_dhcpv6_leases.php"><?=gettext("Status: " .
847
				"DHCPv6 leases"); ?></a> <?=gettext("page."); ?><br />
848
				</span></p>
849
			</td>
850
			</tr>
851
		</table>
852
		<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="static mappings">
853
		<tr>
854
			<td colspan="4" valign="top" class="listtopic"><?=gettext("DHCPv6 Static Mappings for this interface.");?></td>
855
			<td>&nbsp;</td>
856
		</tr>
857
		<tr>
858
			<td width="25%" class="listhdrr"><?=gettext("DUID");?></td>
859
			<td width="15%" class="listhdrr"><?=gettext("IPv6 address");?></td>
860
			<td width="20%" class="listhdrr"><?=gettext("Hostname");?></td>
861
			<td width="30%" class="listhdr"><?=gettext("Description");?></td>
862
			<td width="10%" class="list">
863
			<table border="0" cellspacing="0" cellpadding="1" summary="add">
864
			<tr>
865
			<td valign="middle" width="17"></td>
866
			<td valign="middle"><a href="services_dhcpv6_edit.php?if=<?=$if;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
867
			</tr>
868
			</table>
869
			</td>
870
		</tr>
871
			<?php if(is_array($a_maps)): ?>
872
			<?php $i = 0; foreach ($a_maps as $mapent): ?>
873
			<?php if($mapent['duid'] <> "" or $mapent['ipaddrv6'] <> ""): ?>
874
		<tr>
875
		<td class="listlr" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&amp;id=<?=$i;?>';">
876
			<?=htmlspecialchars($mapent['duid']);?>
877
		</td>
878
		<td class="listr" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&amp;id=<?=$i;?>';">
879
			<?=htmlspecialchars($mapent['ipaddrv6']);?>&nbsp;
880
		</td>
881
		<td class="listr" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&amp;id=<?=$i;?>';">
882
			<?=htmlspecialchars($mapent['hostname']);?>&nbsp;
883
		</td>
884
		<td class="listbg" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&amp;id=<?=$i;?>';">
885
			<?=htmlspecialchars($mapent['descr']);?>&nbsp;
886
		</td>
887
		<td valign="middle" class="list nowrap">
888
			<table border="0" cellspacing="0" cellpadding="1" summary="icons">
889
			<tr>
890
			<td valign="middle"><a href="services_dhcpv6_edit.php?if=<?=$if;?>&amp;id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a></td>
891
			<td valign="middle"><a href="services_dhcpv6.php?if=<?=$if;?>&amp;act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this mapping?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a></td>
892
			</tr>
893
			</table>
894
		</td>
895
		</tr>
896
		<?php endif; ?>
897
		<?php $i++; endforeach; ?>
898
		<?php endif; ?>
899
		<tr>
900
		<td class="list" colspan="4"></td>
901
		<td class="list">
902
			<table border="0" cellspacing="0" cellpadding="1" summary="add">
903
			<tr>
904
			<td valign="middle" width="17"></td>
905
			<td valign="middle"><a href="services_dhcpv6_edit.php?if=<?=$if;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
906
			</tr>
907
			</table>
908
		</td>
909
		</tr>
910
		</table>
911
	</div>
912
</td>
913
</tr>
914
</table>
915
</form>
916
<script type="text/javascript">
917
//<![CDATA[
918
enable_change(false);
919
//]]>
920
</script>
921
<?php include("fend.inc"); ?>
922
</body>
923
</html>
(153-153/256)