Project

General

Profile

Download (39.4 KB) Statistics
| Branch: | Tag: | Revision:

univnautes / usr / local / www / services_dhcpv6.php @ a1b66bec

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
	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
	pfSense_BUILDER_BINARIES:	/bin/rm
37
	pfSense_MODULE:	interfaces
38
*/
39

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

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

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

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

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

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

    
74
if (!$_GET['if'])
75
	$savemsg = gettext("The DHCPv6 Server can only be enabled on interfaces configured with static IP addresses") .
76
		   gettext("Only interfaces configured with a static IP will be shown") . ".";
77

    
78
$iflist = get_configured_interface_with_descr();
79
$iflist = array_merge($iflist, get_configured_pppoe_server_interfaces());
80

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

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

    
129
$ifcfgip = get_interface_ipv6($if);
130
$ifcfgsn = get_interface_subnetv6($if);
131

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

    
137
$dhcrelay_enabled = false;
138
$dhcrelaycfg = $config['dhcrelay6'];
139

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

    
148
if ($_POST) {
149

    
150
	unset($input_errors);
151

    
152
	$old_dhcpdv6_enable = ($pconfig['enable'] == true);
153
	$new_dhcpdv6_enable = ($_POST['enable'] ? true : false);
154
	$dhcpdv6_enable_changed = ($old_dhcpdv6_enable != $new_dhcpdv6_enable);
155

    
156
	$pconfig = $_POST;
157

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

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

    
175
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
176

    
177
		if (($_POST['prefixrange_from'] && !is_ipaddrv6($_POST['prefixrange_from'])))
178
			$input_errors[] = gettext("A valid range must be specified.");
179
		if (($_POST['prefixrange_to'] && !is_ipaddrv6($_POST['prefixrange_to'])))
180
			$input_errors[] = gettext("A valid prefix range must be specified.");
181
		if (($_POST['range_from'] && !is_ipaddrv6($_POST['range_from'])))
182
			$input_errors[] = gettext("A valid range must be specified.");
183
		if (($_POST['range_to'] && !is_ipaddrv6($_POST['range_to'])))
184
			$input_errors[] = gettext("A valid range must be specified.");
185
		if (($_POST['gateway'] && !is_ipaddrv6($_POST['gateway'])))
186
			$input_errors[] = gettext("A valid IPv6 address must be specified for the gateway.");
187
		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'])))
188
			$input_errors[] = gettext("A valid IPv6 address must be specified for each of the DNS servers.");
189

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

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

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

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

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

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

    
253

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

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

    
274
	if (!$input_errors) {
275
		if (!is_array($config['dhcpdv6'][$if]))
276
			$config['dhcpdv6'][$if] = array();
277
		if (!is_array($config['dhcpdv6'][$if]['range']))
278
			$config['dhcpdv6'][$if]['range'] = array();
279
		if (!is_array($config['dhcpdv6'][$if]['prefixrange']))
280
			$config['dhcpdv6'][$if]['prefixrange'] = array();
281

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

    
291
		unset($config['dhcpdv6'][$if]['winsserver']);
292

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

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

    
312
		unset($config['dhcpdv6'][$if]['ntpserver']);
313
		if ($_POST['ntp1'])
314
			$config['dhcpdv6'][$if]['ntpserver'][] = $_POST['ntp1'];
315
		if ($_POST['ntp2'])
316
			$config['dhcpdv6'][$if]['ntpserver'][] = $_POST['ntp2'];
317

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

    
324
		// Handle the custom options rowhelper
325
		if(isset($config['dhcpdv6'][$if]['numberoptions']['item']))
326
			unset($config['dhcpdv6'][$if]['numberoptions']['item']);
327

    
328
		$config['dhcpdv6'][$if]['numberoptions'] = $numberoptions;
329

    
330
		write_config();
331

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

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

    
377
$closehead = false;
378
$pgtitle = array(gettext("Services"),gettext("DHCPv6 server"));
379
$shortcut_section = "dhcp6";
380

    
381
include("head.inc");
382

    
383
?>
384

    
385
<script type="text/javascript" src="/javascript/row_helper.js">
386
</script>
387

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

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

    
432
	function show_shownumbervalue() {
433
		document.getElementById("shownumbervaluebox").innerHTML='';
434
		aodiv = document.getElementById('shownumbervalue');
435
		aodiv.style.display = "block";
436
	}
437

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

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

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

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

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

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