Project

General

Profile

Download (37.9 KB) Statistics
| Branch: | Tag: | Revision:
1 99caa67c Seth Mos
<?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 (http://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 472ad9a0 Renato Botelho
require_once("filter.inc");
49 99caa67c Seth Mos
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 1c8dbfbb Darren Embry
	$savemsg = "<p><b>" . gettext("The DHCPv6 Server can only be enabled on interfaces configured with static IP addresses") . ".</b></p>" .
76
		   "<p><b>" . gettext("Only interfaces configured with a static IP will be shown") . ".</b></p>";
77 99caa67c Seth Mos
78
$iflist = get_configured_interface_with_descr();
79 16d9ad13 smos
$iflist = array_merge($iflist, get_configured_pppoe_server_interfaces());
80 99caa67c Seth Mos
81
/* set the starting interface */
82
if (!$if || !isset($iflist[$if])) {
83
	foreach ($iflist as $ifent => $ifname) {
84
		$oc = $config['interfaces'][$ifent];
85 db7a628c Renato Botelho
		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 99caa67c Seth Mos
			continue;
88
		$if = $ifent;
89
		break;
90
	}
91
}
92
93
if (is_array($config['dhcpdv6'][$if])){
94 fe838158 smos
	/* DHCPv6 */
95 99caa67c Seth Mos
	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 bfb3e717 Seth Mos
	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 99caa67c Seth Mos
	$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 13399e17 Seth Mos
	list($pconfig['wins1'],$pconfig['wins2']) = $config['dhcpdv6'][$if]['winsserver'];
109
	list($pconfig['dns1'],$pconfig['dns2']) = $config['dhcpdv6'][$if]['dnsserver'];
110 99caa67c Seth Mos
	$pconfig['enable'] = isset($config['dhcpdv6'][$if]['enable']);
111
	$pconfig['denyunknown'] = isset($config['dhcpdv6'][$if]['denyunknown']);
112
	$pconfig['ddnsdomain'] = $config['dhcpdv6'][$if]['ddnsdomain'];
113
	$pconfig['ddnsupdate'] = isset($config['dhcpdv6'][$if]['ddnsupdate']);
114
	list($pconfig['ntp1'],$pconfig['ntp2']) = $config['dhcpdv6'][$if]['ntpserver'];
115
	$pconfig['tftp'] = $config['dhcpdv6'][$if]['tftp'];
116
	$pconfig['ldap'] = $config['dhcpdv6'][$if]['ldap'];
117
	$pconfig['netboot'] = isset($config['dhcpdv6'][$if]['netboot']);
118 a2578c27 Anthony Wrather
	$pconfig['nextserver'] = $config['dhcpdv6'][$if]['nextserver'];
119 99caa67c Seth Mos
	$pconfig['filename'] = $config['dhcpdv6'][$if]['filename'];
120
	$pconfig['rootpath'] = $config['dhcpdv6'][$if]['rootpath'];
121
	$pconfig['netmask'] = $config['dhcpdv6'][$if]['netmask'];
122
	$pconfig['numberoptions'] = $config['dhcpdv6'][$if]['numberoptions'];
123 138208bf Joecowboy
	$pconfig['dhcpv6leaseinlocaltime'] = $config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'];
124 99caa67c Seth Mos
	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 80c88a68 smos
$dhcrelaycfg = $config['dhcrelay6'];
139 99caa67c Seth Mos
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 472ad9a0 Renato Botelho
	$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 99caa67c Seth Mos
	$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 1e9b4611 Renato Botelho
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
176 99caa67c Seth Mos
177 bfb3e717 Seth Mos
		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 cd9fa56b Seth Mos
		if (($_POST['range_from'] && !is_ipaddrv6($_POST['range_from'])))
182 99caa67c Seth Mos
			$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'])))
188
			$input_errors[] = gettext("A valid IPv6 address must be specified for the primary/secondary 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 a3de8b9e Pierre POMES
		if ($_POST['domainsearchlist']) {
197
			$domain_array=preg_split("/[ ;]+/",$_POST['domainsearchlist']);
198
			foreach ($domain_array as $curdomain) {
199
				if (!is_domain($curdomain)) {
200
					$input_errors[] = gettext("A valid domain search list must be specified.");
201
					break;
202
				}
203
			}
204
		}
205
206 99caa67c Seth Mos
		if (($_POST['ntp1'] && !is_ipaddrv6($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddrv6($_POST['ntp2'])))
207
			$input_errors[] = gettext("A valid IPv6 address must be specified for the primary/secondary NTP servers.");
208
		if (($_POST['domain'] && !is_domain($_POST['domain'])))
209
			$input_errors[] = gettext("A valid domain name must be specified for the DNS domain.");
210
		if ($_POST['tftp'] && !is_ipaddr($_POST['tftp']) && !is_domain($_POST['tftp']) && !is_URL($_POST['tftp']))
211
			$input_errors[] = gettext("A valid IPv6 address or hostname must be specified for the TFTP server.");
212
		if (($_POST['nextserver'] && !is_ipaddrv6($_POST['nextserver'])))
213
			$input_errors[] = gettext("A valid IPv6 address must be specified for the network boot server.");
214
215
		// Disallow a range that includes the virtualip
216
		if (is_array($config['virtualip']['vip'])) {
217
			foreach($config['virtualip']['vip'] as $vip) {
218
				if($vip['interface'] == $if)
219 41b4867e Renato Botelho
					if($vip['subnetv6'] && is_inrange_v6($vip['subnetv6'], $_POST['range_from'], $_POST['range_to']))
220 99caa67c Seth Mos
						$input_errors[] = sprintf(gettext("The subnet range cannot overlap with virtual IPv6 address %s."),$vip['subnetv6']);
221
			}
222
		}
223
224
		$noip = false;
225
		if(is_array($a_maps))
226
			foreach ($a_maps as $map)
227
				if (empty($map['ipaddrv6']))
228
					$noip = true;
229
		if (!$input_errors) {
230
			/* make sure the range lies within the current subnet */
231
			$subnet_start = gen_subnetv6($ifcfgip, $ifcfgsn);
232
			$subnet_end = gen_subnetv6_max($ifcfgip, $ifcfgsn);
233
234 16d9ad13 smos
			if (is_ipaddrv6($ifcfgip)) {
235 41b4867e Renato Botelho
				if ((! is_inrange_v6($_POST['range_from'], $subnet_start, $subnet_end)) ||
236
			   	 (! is_inrange_v6($_POST['range_to'], $subnet_start, $subnet_end))) {
237 16d9ad13 smos
					$input_errors[] = gettext("The specified range lies outside of the current subnet.");
238
				}
239 99caa67c Seth Mos
			}
240 731de711 Pierre POMES
			/* "from" cannot be higher than "to" */
241
			if (inet_pton($_POST['range_from']) > inet_pton($_POST['range_to']))
242 99caa67c Seth Mos
				$input_errors[] = gettext("The range is invalid (first element higher than second element).");
243
244
			/* make sure that the DHCP Relay isn't enabled on this interface */
245
			if (isset($config['dhcrelay'][$if]['enable']))
246
				$input_errors[] = sprintf(gettext("You must disable the DHCP relay on the %s interface before enabling the DHCP server."),$iflist[$if]);
247
248 731de711 Pierre POMES
249
			/* Verify static mappings do not overlap:
250
			   - available DHCP range
251
			   - prefix delegation range (FIXME: still need to be completed) */
252
			$dynsubnet_start = inet_pton($_POST['range_from']);
253
			$dynsubnet_end = inet_pton($_POST['range_to']);
254
255 99caa67c Seth Mos
			if(is_array($a_maps)) {
256
				foreach ($a_maps as $map) {
257
					if (empty($map['ipaddrv6']))
258
						continue;
259 731de711 Pierre POMES
					if ((inet_pton($map['ipaddrv6']) > $dynsubnet_start) &&
260 17aa0c18 Pierre POMES
						(inet_pton($map['ipaddrv6']) < $dynsubnet_end)) {
261 99caa67c Seth Mos
						$input_errors[] = sprintf(gettext("The DHCP range cannot overlap any static DHCP mappings."));
262
						break;
263
					}
264
				}
265
			}
266
		}
267
	}
268
269
	if (!$input_errors) {
270
		if (!is_array($config['dhcpdv6'][$if]))
271
			$config['dhcpdv6'][$if] = array();
272
		if (!is_array($config['dhcpdv6'][$if]['range']))
273
			$config['dhcpdv6'][$if]['range'] = array();
274 bfb3e717 Seth Mos
		if (!is_array($config['dhcpdv6'][$if]['prefixrange']))
275
			$config['dhcpdv6'][$if]['prefixrange'] = array();
276 99caa67c Seth Mos
277
		$config['dhcpdv6'][$if]['range']['from'] = $_POST['range_from'];
278
		$config['dhcpdv6'][$if]['range']['to'] = $_POST['range_to'];
279 bfb3e717 Seth Mos
		$config['dhcpdv6'][$if]['prefixrange']['from'] = $_POST['prefixrange_from'];
280
		$config['dhcpdv6'][$if]['prefixrange']['to'] = $_POST['prefixrange_to'];
281
		$config['dhcpdv6'][$if]['prefixrange']['prefixlength'] = $_POST['prefixrange_length'];
282 99caa67c Seth Mos
		$config['dhcpdv6'][$if]['defaultleasetime'] = $_POST['deftime'];
283
		$config['dhcpdv6'][$if]['maxleasetime'] = $_POST['maxtime'];
284
		$config['dhcpdv6'][$if]['netmask'] = $_POST['netmask'];
285
286
		unset($config['dhcpdv6'][$if]['winsserver']);
287
288
		unset($config['dhcpdv6'][$if]['dnsserver']);
289
		if ($_POST['dns1'])
290
			$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns1'];
291
		if ($_POST['dns2'])
292
			$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns2'];
293
294
		$config['dhcpdv6'][$if]['domain'] = $_POST['domain'];
295
		$config['dhcpdv6'][$if]['domainsearchlist'] = $_POST['domainsearchlist'];
296
		$config['dhcpdv6'][$if]['denyunknown'] = ($_POST['denyunknown']) ? true : false;
297
		$config['dhcpdv6'][$if]['enable'] = ($_POST['enable']) ? true : false;
298
		$config['dhcpdv6'][$if]['ddnsdomain'] = $_POST['ddnsdomain'];
299
		$config['dhcpdv6'][$if]['ddnsupdate'] = ($_POST['ddnsupdate']) ? true : false;
300
301
		unset($config['dhcpdv6'][$if]['ntpserver']);
302
		if ($_POST['ntp1'])
303
			$config['dhcpdv6'][$if]['ntpserver'][] = $_POST['ntp1'];
304
		if ($_POST['ntp2'])
305
			$config['dhcpdv6'][$if]['ntpserver'][] = $_POST['ntp2'];
306
307
		$config['dhcpdv6'][$if]['tftp'] = $_POST['tftp'];
308
		$config['dhcpdv6'][$if]['ldap'] = $_POST['ldap'];
309
		$config['dhcpdv6'][$if]['netboot'] = ($_POST['netboot']) ? true : false;
310 a2578c27 Anthony Wrather
		$config['dhcpdv6'][$if]['nextserver'] = $_POST['nextserver'];
311 99caa67c Seth Mos
		$config['dhcpdv6'][$if]['filename'] = $_POST['filename'];
312
		$config['dhcpdv6'][$if]['rootpath'] = $_POST['rootpath'];
313 138208bf Joecowboy
		$config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'] = $_POST['dhcpv6leaseinlocaltime'];
314 99caa67c Seth Mos
315
		// Handle the custom options rowhelper
316
		if(isset($config['dhcpdv6'][$if]['numberoptions']['item']))
317
			unset($config['dhcpdv6'][$if]['numberoptions']['item']);
318
319
		$config['dhcpdv6'][$if]['numberoptions'] = $numberoptions;
320
321
		write_config();
322
323
		$retval = 0;
324
		$retvaldhcp = 0;
325
		$retvaldns = 0;
326
		/* Stop DHCPv6 so we can cleanup leases */
327 e074fb75 Renato Botelho
		killbypid("{$g['dhcpd_chroot_path']}{$g['varrun_path']}/dhcpdv6.pid");
328 2fb056d8 Seth Mos
		// dhcp_clean_leases();
329 99caa67c Seth Mos
		/* dnsmasq_configure calls dhcpd_configure */
330
		/* no need to restart dhcpd twice */
331 ea1aca13 Renato Botelho
		if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic']))	{
332 99caa67c Seth Mos
			$retvaldns = services_dnsmasq_configure();
333
			if ($retvaldns == 0) {
334
				clear_subsystem_dirty('hosts');
335
				clear_subsystem_dirty('staticmaps');
336
			}
337
		} else {
338
			$retvaldhcp = services_dhcpd_configure();
339
			if ($retvaldhcp == 0)
340
				clear_subsystem_dirty('staticmaps');
341
		}
342 472ad9a0 Renato Botelho
		if ($dhcpdv6_enable_changed)
343
			$retvalfc = filter_configure();
344
		if($retvaldhcp == 1 || $retvaldns == 1 || $retvalfc == 1)
345 99caa67c Seth Mos
			$retval = 1;
346
		$savemsg = get_std_save_message($retval);
347
	}
348
}
349
350
if ($_GET['act'] == "del") {
351
	if ($a_maps[$_GET['id']]) {
352
		unset($a_maps[$_GET['id']]);
353
		write_config();
354
		if(isset($config['dhcpdv6'][$if]['enable'])) {
355
			mark_subsystem_dirty('staticmapsv6');
356 ea1aca13 Renato Botelho
			if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstaticv6']))
357 99caa67c Seth Mos
				mark_subsystem_dirty('hosts');
358
		}
359
		header("Location: services_dhcpv6.php?if={$if}");
360
		exit;
361
	}
362
}
363
364
$pgtitle = array(gettext("Services"),gettext("DHCPv6 server"));
365 b32dd0a6 jim-p
$shortcut_section = "dhcp6";
366 99caa67c Seth Mos
367
include("head.inc");
368
369
?>
370
371
<script type="text/javascript" src="/javascript/row_helper.js">
372
</script>
373
374
<script type="text/javascript">
375
	rowname[0] = "number";
376
	rowtype[0] = "textbox";
377
	rowsize[0] = "10";
378
	rowname[1] = "value";
379
	rowtype[1] = "textbox";
380
	rowsize[1] = "55";
381
</script>
382
383
<script type="text/javascript" language="JavaScript">
384 2fb056d8 Seth Mos
	function enable_change(enable_over) {
385
		var endis;
386
		endis = !(document.iform.enable.checked || enable_over);
387
		document.iform.range_from.disabled = endis;
388
		document.iform.range_to.disabled = endis;
389 bfb3e717 Seth Mos
		document.iform.prefixrange_from.disabled = endis;
390
		document.iform.prefixrange_to.disabled = endis;
391
		document.iform.prefixrange_length.disabled = endis;
392 2fb056d8 Seth Mos
		document.iform.dns1.disabled = endis;
393
		document.iform.dns2.disabled = endis;
394
		document.iform.deftime.disabled = endis;
395
		document.iform.maxtime.disabled = endis;
396 adaa3f75 Joecowboy
		//document.iform.gateway.disabled = endis;
397 138208bf Joecowboy
		document.iform.dhcpv6leaseinlocaltime.disabled = endis;
398 2fb056d8 Seth Mos
		document.iform.domain.disabled = endis;
399
		document.iform.domainsearchlist.disabled = endis;
400
		document.iform.ddnsdomain.disabled = endis;
401
		document.iform.ddnsupdate.disabled = endis;
402 4096fe5d smos
		document.iform.ntp1.disabled = endis;
403
		document.iform.ntp2.disabled = endis;
404 adaa3f75 Joecowboy
		//document.iform.tftp.disabled = endis;
405 2fb056d8 Seth Mos
		document.iform.ldap.disabled = endis;
406
		document.iform.netboot.disabled = endis;
407
		document.iform.nextserver.disabled = endis;
408
		document.iform.filename.disabled = endis;
409
		document.iform.rootpath.disabled = endis;
410
		document.iform.denyunknown.disabled = endis;
411 99caa67c Seth Mos
	}
412
413
	function show_shownumbervalue() {
414
		document.getElementById("shownumbervaluebox").innerHTML='';
415
		aodiv = document.getElementById('shownumbervalue');
416
		aodiv.style.display = "block";
417
	}
418
419
	function show_ddns_config() {
420
		document.getElementById("showddnsbox").innerHTML='';
421
		aodiv = document.getElementById('showddns');
422
		aodiv.style.display = "block";
423
	}
424
	function show_ntp_config() {
425
		document.getElementById("showntpbox").innerHTML='';
426
		aodiv = document.getElementById('showntp');
427
		aodiv.style.display = "block";
428
	}
429 7d504365 smos
	/*
430 99caa67c Seth Mos
	function show_tftp_config() {
431
		document.getElementById("showtftpbox").innerHTML='';
432
		aodiv = document.getElementById('showtftp');
433
		aodiv.style.display = "block";
434
	}
435 7d504365 smos
	*/
436 99caa67c Seth Mos
	function show_ldap_config() {
437
		document.getElementById("showldapbox").innerHTML='';
438
		aodiv = document.getElementById('showldap');
439
		aodiv.style.display = "block";
440
	}
441
442
	function show_netboot_config() {
443
		document.getElementById("shownetbootbox").innerHTML='';
444
		aodiv = document.getElementById('shownetboot');
445
		aodiv.style.display = "block";
446
	}
447
</script>
448
449
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
450
<?php include("fbegin.inc"); ?>
451
<form action="services_dhcpv6.php" method="post" name="iform" id="iform">
452
<?php if ($input_errors) print_input_errors($input_errors); ?>
453
<?php if ($savemsg) print_info_box($savemsg); ?>
454
<?php
455
	if ($dhcrelay_enabled) {
456
		echo gettext("DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.");
457
		include("fend.inc");
458
		echo "</body>";
459
		echo "</html>";
460
		exit;
461
	}
462
?>
463
<?php if (is_subsystem_dirty('staticmaps')): ?><p>
464
<?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>
465
<?php endif; ?>
466
<table width="100%" border="0" cellpadding="0" cellspacing="0">
467
<tr><td>
468
<?php
469
	/* active tabs */
470
	$tab_array = array();
471
	$tabscounter = 0;
472
	$i = 0;
473
	foreach ($iflist as $ifent => $ifname) {
474
		$oc = $config['interfaces'][$ifent];
475 db7a628c Renato Botelho
		if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
476
			(!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))))
477 99caa67c Seth Mos
			continue;
478
		if ($ifent == $if)
479
			$active = true;
480
		else
481
			$active = false;
482
		$tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}");
483
		$tabscounter++;
484
	}
485 16d9ad13 smos
	/* tack on PPPoE or PPtP servers here */
486
	/* pppoe server */
487
	if (is_array($config['pppoes']['pppoe'])) {
488
		foreach($config['pppoes']['pppoe'] as $pppoe) {
489
			if ($pppoe['mode'] == "server") {
490
				$ifent = "poes". $pppoe['pppoeid'];
491
				$ifname = strtoupper($ifent);
492
				if ($ifent == $if)
493
					$active = true;
494
				else
495
					$active = false;
496
				$tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}");
497
				$tabscounter++;
498
			}
499
		}
500
	}
501 99caa67c Seth Mos
	if ($tabscounter == 0) {
502
		echo "</td></tr></table></form>";
503
		include("fend.inc");
504
		echo "</body>";
505
		echo "</html>";
506
		exit;
507
	}
508
	display_top_tabs($tab_array);
509
?>
510
</td></tr>
511 1c8dbfbb Darren Embry
<tr><td class="tabnavtbl">
512
<?php
513
$tab_array = array();
514
$tab_array[] = array(gettext("DHCPv6 Server"),         true,  "services_dhcpv6.php?if={$if}");
515
$tab_array[] = array(gettext("Router Advertisements"), false, "services_router_advertisements.php?if={$if}");
516
display_top_tabs($tab_array);
517
?>
518
</td></tr>
519 99caa67c Seth Mos
<tr>
520
<td>
521
	<div id="mainarea">
522 fe838158 smos
		<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
523
		<tr>
524
			<td width="22%" valign="top" class="vncellreq"><?=gettext("DHCPv6 Server");?></td>
525 2fb056d8 Seth Mos
			<td width="78%" class="vtable">
526
				<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false);">
527
			<strong><?php printf(gettext("Enable DHCPv6 server on " .
528
			"%s " .
529
			"interface"),htmlspecialchars($iflist[$if]));?></strong></td>
530
			</tr>
531
			<tr>
532
			<td width="22%" valign="top" class="vtable">&nbsp;</td>
533 99caa67c Seth Mos
			<td width="78%" class="vtable">
534
				<input name="denyunknown" id="denyunknown" type="checkbox" value="yes" <?php if ($pconfig['denyunknown']) echo "checked"; ?>>
535
				<strong><?=gettext("Deny unknown clients");?></strong><br>
536
				<?=gettext("If this is checked, only the clients defined below will get DHCP leases from this server. ");?></td>
537
			</tr>
538
			<tr>
539 16d9ad13 smos
			<?php
540
			/* the PPPoE Server could well have no IPv6 address and operate fine with just link-local, just hide these */
541
			if(is_ipaddrv6($ifcfgip)) {
542
			?>
543 99caa67c Seth Mos
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet");?></td>
544
			<td width="78%" class="vtable">
545
				<?=gen_subnetv6($ifcfgip, $ifcfgsn);?>
546
			</td>
547
			</tr>
548
			<tr>
549
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet mask");?></td>
550
			<td width="78%" class="vtable">
551
				<?=$ifcfgsn;?> bits
552
			</td>
553
			</tr>
554
			<tr>
555
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Available range");?></td>
556
			<td width="78%" class="vtable">
557
			<?php
558
				$range_from = gen_subnetv6($ifcfgip, $ifcfgsn);
559
				$range_from++;
560
				echo $range_from;
561
562
			?>
563
			-
564
			<?php
565 47335ae3 Pierre POMES
				$range_to = gen_subnetv6_max($ifcfgip, $ifcfgsn);
566 99caa67c Seth Mos
				echo $range_to;
567
			?>
568
			</td>
569
			</tr>
570 16d9ad13 smos
			<?php } ?>
571
572 99caa67c Seth Mos
			<?php if($is_olsr_enabled): ?>
573
			<tr>
574
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet Mask");?></td>
575
			<td width="78%" class="vtable">
576
				<select name="netmask" class="formselect" id="netmask">
577
				<?php
578 8a3b09ef Seth Mos
				for ($i = 128; $i > 0; $i--) {
579
					if($i <> 127) {
580 99caa67c Seth Mos
						echo "<option value=\"{$i}\" ";
581
						if ($i == $pconfig['netmask']) echo "selected";
582
						echo ">" . $i . "</option>";
583
					}
584
				}
585
				?>
586
				</select>
587
			</td>
588
			</tr>
589
			<?php endif; ?>
590
			<tr>
591
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Range");?></td>
592
			<td width="78%" class="vtable">
593 8a3b09ef Seth Mos
				<input name="range_from" type="text" class="formfld unknown" id="range_from" size="28" value="<?=htmlspecialchars($pconfig['range_from']);?>">
594
				&nbsp;<?=gettext("to"); ?>&nbsp; <input name="range_to" type="text" class="formfld unknown" id="range_to" size="28" value="<?=htmlspecialchars($pconfig['range_to']);?>">
595 99caa67c Seth Mos
			</td>
596
			</tr>
597
			<tr>
598 cd9fa56b Seth Mos
			<td width="22%" valign="top" class="vncell"><?=gettext("Prefix Delegation Range");?></td>
599 bfb3e717 Seth Mos
			<td width="78%" class="vtable">
600
				<input name="prefixrange_from" type="text" class="formfld unknown" id="prefixrange_from" size="28" value="<?=htmlspecialchars($pconfig['prefixrange_from']);?>">
601
				&nbsp;<?=gettext("to"); ?>&nbsp; <input name="prefixrange_to" type="text" class="formfld unknown" id="prefixrange_to" size="28" value="<?=htmlspecialchars($pconfig['prefixrange_to']);?>">
602 8707707e jim-p
				&nbsp;<br/><?=gettext("Prefix Delegation Size"); ?>:&nbsp; <select name="prefixrange_length" class="formselect" id="prefixrange_length">
603 bfb3e717 Seth Mos
					<option value="48" <?php if($pconfig['prefixrange_length'] == 48) echo "selected"; ?>>48</option>
604 50a6400f smos
					<option value="52" <?php if($pconfig['prefixrange_length'] == 52) echo "selected"; ?>>52</option>
605 bfb3e717 Seth Mos
					<option value="56" <?php if($pconfig['prefixrange_length'] == 56) echo "selected"; ?>>56</option>
606
					<option value="60" <?php if($pconfig['prefixrange_length'] == 60) echo "selected"; ?>>60</option>
607 50a6400f smos
					<option value="62" <?php if($pconfig['prefixrange_length'] == 62) echo "selected"; ?>>62</option>
608 79909926 smos
					<option value="63" <?php if($pconfig['prefixrange_length'] == 63) echo "selected"; ?>>63</option>
609
					<option value="64" <?php if($pconfig['prefixrange_length'] == 64) echo "selected"; ?>>64</option>
610 bfb3e717 Seth Mos
				</select> <br/>
611
				<?php echo gettext("You can define a Prefix range here for DHCP Prefix Delegation. This allows for 
612 e1cc1f6d smos
					assigning networks to subrouters. The start and end of the range must end on boundaries of the prefix delegation size."); ?>
613 bfb3e717 Seth Mos
			</td>
614
			</tr>
615
			<tr>
616 99caa67c Seth Mos
			<td width="22%" valign="top" class="vncell"><?=gettext("DNS servers");?></td>
617
			<td width="78%" class="vtable">
618 8a3b09ef Seth Mos
				<input name="dns1" type="text" class="formfld unknown" id="dns1" size="28" value="<?=htmlspecialchars($pconfig['dns1']);?>"><br>
619
				<input name="dns2" type="text" class="formfld unknown" id="dns2" size="28" value="<?=htmlspecialchars($pconfig['dns2']);?>"><br>
620 99caa67c Seth Mos
				<?=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.");?>
621
			</td>
622
			</tr>
623
			<tr>
624
			<td width="22%" valign="top" class="vncell"><?=gettext("Domain name");?></td>
625
			<td width="78%" class="vtable">
626 8a3b09ef Seth Mos
				<input name="domain" type="text" class="formfld unknown" id="domain" size="28" value="<?=htmlspecialchars($pconfig['domain']);?>"><br>
627 99caa67c Seth Mos
				 <?=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.");?>
628
			 </td>
629
			</tr>
630
			<tr>
631
			<td width="22%" valign="top" class="vncell"><?=gettext("Domain search list");?></td>
632
			<td width="78%" class="vtable">
633 8a3b09ef Seth Mos
				<input name="domainsearchlist" type="text" class="formfld unknown" id="domainsearchlist" size="28" value="<?=htmlspecialchars($pconfig['domainsearchlist']);?>"><br>
634 5aa68a55 Renato Botelho
				<?=gettext("The DHCP server can optionally provide a domain search list. Use the semicolon character as separator");?>
635 99caa67c Seth Mos
			</td>
636
			</tr>
637
			<tr>
638
			<td width="22%" valign="top" class="vncell"><?=gettext("Default lease time");?></td>
639
			<td width="78%" class="vtable">
640
				<input name="deftime" type="text" class="formfld unknown" id="deftime" size="10" value="<?=htmlspecialchars($pconfig['deftime']);?>">
641
				<?=gettext("seconds");?><br>
642
				<?=gettext("This is used for clients that do not ask for a specific " .
643
				"expiration time."); ?><br>
644
				<?=gettext("The default is 7200 seconds.");?>
645
			</td>
646
			</tr>
647
			<tr>
648
			<td width="22%" valign="top" class="vncell"><?=gettext("Maximum lease time");?></td>
649
			<td width="78%" class="vtable">
650
				<input name="maxtime" type="text" class="formfld unknown" id="maxtime" size="10" value="<?=htmlspecialchars($pconfig['maxtime']);?>">
651
				<?=gettext("seconds");?><br>
652
				<?=gettext("This is the maximum lease time for clients that ask".
653
				" for a specific expiration time."); ?><br>
654
				<?=gettext("The default is 86400 seconds.");?>
655
			</td>
656
			</tr>
657 7d0ad4ec Joecowboy
			<tr>
658
				<td width="22%" valign="top" class="vncell"><?=gettext("Time format change"); ?></td>
659
				<td width="78%" class="vtable">
660
				<table>
661
					<tr>
662
					<td>
663 138208bf Joecowboy
						<input name="dhcpv6leaseinlocaltime" type="checkbox" id="dhcpv6leaseinlocaltime" value="yes" <?php if ($pconfig['dhcpv6leaseinlocaltime']) echo "checked"; ?>>
664 7d0ad4ec Joecowboy
					</td>
665
					<td>
666
						<strong>
667
							<?=gettext("Change DHCPv6 display lease time from UTC to local time."); ?>
668
						</strong>
669
					</td>
670
					</tr>
671
					<tr>
672
					<td>&nbsp;</td>
673
					<td>
674
						<span class="red"><strong><?=gettext("Note:");?></strong></span> <?=gettext("By default DHCPv6 leases are displayed in UTC time.  By checking this 
675
						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."); ?>
676
					
677
					</td>
678
					</tr>
679
				</table>
680
				</td>
681
			</tr>
682 99caa67c Seth Mos
			<tr>
683
			<td width="22%" valign="top" class="vncell"><?=gettext("Dynamic DNS");?></td>
684
			<td width="78%" class="vtable">
685
				<div id="showddnsbox">
686
					<input type="button" onClick="show_ddns_config()" value="<?=gettext("Advanced");?>"></input> - <?=gettext("Show Dynamic DNS");?></a>
687
				</div>
688
				<div id="showddns" style="display:none">
689
					<input valign="middle" type="checkbox" value="yes" name="ddnsupdate" id="ddnsupdate" <?php if($pconfig['ddnsupdate']) echo " checked"; ?>>&nbsp;
690
					<b><?=gettext("Enable registration of DHCP client names in DNS.");?></b><br />
691
					<p>
692 8a3b09ef Seth Mos
					<input name="ddnsdomain" type="text" class="formfld unknown" id="ddnsdomain" size="28" value="<?=htmlspecialchars($pconfig['ddnsdomain']);?>"><br />
693 99caa67c Seth Mos
					<?=gettext("Note: Leave blank to disable dynamic DNS registration.");?><br />
694
					<?=gettext("Enter the dynamic DNS domain which will be used to register client names in the DNS server.");?>
695
				</div>
696
			</td>
697
			</tr>
698
			<tr>
699
			<td width="22%" valign="top" class="vncell"><?=gettext("NTP servers");?></td>
700
			<td width="78%" class="vtable">
701
				<div id="showntpbox">
702
					<input type="button" onClick="show_ntp_config()" value="<?=gettext("Advanced");?>"></input> - <?=gettext("Show NTP configuration");?></a>
703
				</div>
704
				<div id="showntp" style="display:none">
705 8a3b09ef Seth Mos
					<input name="ntp1" type="text" class="formfld unknown" id="ntp1" size="28" value="<?=htmlspecialchars($pconfig['ntp1']);?>"><br>
706
					<input name="ntp2" type="text" class="formfld unknown" id="ntp2" size="28" value="<?=htmlspecialchars($pconfig['ntp2']);?>">
707 99caa67c Seth Mos
				</div>
708
			</td>
709
			</tr>
710 7d504365 smos
			<!-- ISC dhcpd does not support tftp for ipv6 yet. See redmine #2016
711 99caa67c Seth Mos
			<tr>
712
			<td width="22%" valign="top" class="vncell"><?=gettext("TFTP server");?></td>
713
			<td width="78%" class="vtable">
714
			<div id="showtftpbox">
715
				<input type="button" onClick="show_tftp_config()" value="<?=gettext("Advanced");?>"></input> - <?=gettext("Show TFTP configuration");?></a>
716
			</div>
717
			<div id="showtftp" style="display:none">
718
				<input name="tftp" type="text" class="formfld unknown" id="tftp" size="50" value="<?=htmlspecialchars($pconfig['tftp']);?>"><br>
719
				<?=gettext("Leave blank to disable.  Enter a full hostname or IP for the TFTP server.");?>
720
			</div>
721
			</td>
722
			</tr>
723 7d504365 smos
			-->
724 99caa67c Seth Mos
			<tr>
725
			<td width="22%" valign="top" class="vncell"><?=gettext("LDAP URI");?></td>
726
			<td width="78%" class="vtable">
727
				<div id="showldapbox">
728
					<input type="button" onClick="show_ldap_config()" value="<?=gettext("Advanced");?>"></input> - <?=gettext("Show LDAP configuration");?></a>
729
				</div>
730
				<div id="showldap" style="display:none">
731
					<input name="ldap" type="text" class="formfld unknown" id="ldap" size="80" value="<?=htmlspecialchars($pconfig['ldap']);?>"><br>
732
					<?=gettext("Leave blank to disable.  Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com");?>
733
				</div>
734
			</td>
735
			</tr>
736
			<tr>
737
			<td width="22%" valign="top" class="vncell"><?=gettext("Enable network booting");?></td>
738
			<td width="78%" class="vtable">
739
				<div id="shownetbootbox">
740
					<input type="button" onClick="show_netboot_config()" value="<?=gettext("Advanced");?>"></input> - <?=gettext("Show Network booting");?></a>
741
				</div>
742
				<div id="shownetboot" style="display:none">
743
					<input valign="middle" type="checkbox" value="yes" name="netboot" id="netboot" <?php if($pconfig['netboot']) echo " checked"; ?>>&nbsp;
744
					<b><?=gettext("Enables network booting.");?></b>
745
					<p>
746
					<?=gettext("Enter the IP of the"); ?> <b><?=gettext("next-server"); ?></b>
747 8a3b09ef Seth Mos
					<input name="nextserver" type="text" class="formfld unknown" id="nextserver" size="28" value="<?=htmlspecialchars($pconfig['nextserver']);?>">
748 99caa67c Seth Mos
					<?=gettext("and the filename");?>
749 8a3b09ef Seth Mos
					<input name="filename" type="text" class="formfld unknown" id="filename" size="28" value="<?=htmlspecialchars($pconfig['filename']);?>"><br>
750 99caa67c Seth Mos
					<?=gettext("Note: You need both a filename and a boot server configured for this to work!");?>
751
					<p>
752
					<?=gettext("Enter the"); ?> <b><?=gettext("root-path"); ?></b>-<?=gettext("string");?>
753
					<input name="rootpath" type="text" class="formfld unknown" id="rootpath" size="90" value="<?=htmlspecialchars($pconfig['rootpath']);?>"><br>
754
					<?=gettext("Note: string-format: iscsi:(servername):(protocol):(port):(LUN):targetname");?>
755
				</div>
756
			</td>
757
			</tr>
758
			<tr>
759
			<td width="22%" valign="top" class="vncell"><?=gettext("Additional BOOTP/DHCP Options");?></td>
760
			<td width="78%" class="vtable">
761
				<div id="shownumbervaluebox">
762
					<input type="button" onClick="show_shownumbervalue()" value="<?=gettext("Advanced");?>"></input> - <?=gettext("Show Additional BOOTP/DHCP Options");?></a>
763
				</div>
764
				<div id="shownumbervalue" style="display:none">
765
				<table id="maintable">
766
				<tbody>
767
				<tr>
768
				<td colspan="3">
769
					<div style="padding:5px; margin-top: 16px; margin-bottom: 16px; border:1px dashed #000066; background-color: #ffffff; color: #000000; font-size: 8pt;" id="itemhelp">
770
					<?=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="_new"><?=gettext("URL"); ?></a>
771
					</div>
772
				</td>
773
				</tr>
774
				<tr>
775
				<td><div id="onecolumn"><?=gettext("Number");?></div></td>
776
				<td><div id="twocolumn"><?=gettext("Value");?></div></td>
777
				</tr>
778
				<?php $counter = 0; ?>
779
				<?php
780
					if($pconfig['numberoptions'])
781
						foreach($pconfig['numberoptions']['item'] as $item):
782
				?>
783
					<?php
784
						$number = $item['number'];
785
						$value = $item['value'];
786
					?>
787
				<tr>
788
				<td>
789
					<input autocomplete="off" name="number<?php echo $counter; ?>" type="text" class="formfld" id="number<?php echo $counter; ?>" size="10" value="<?=htmlspecialchars($number);?>" />
790
				</td>
791
				<td>
792
					<input autocomplete="off" name="value<?php echo $counter; ?>" type="text" class="formfld" id="value<?php echo $counter; ?>" size="55" value="<?=htmlspecialchars($value);?>" />
793
				</td>
794
				<td>
795
					<input type="image" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" onclick="removeRow(this); return false;" value="<?=gettext("Delete");?>" />
796
				</td>
797
				</tr>
798
				<?php $counter++; ?>
799
				<?php endforeach; ?>
800
				</tbody>
801
				<tfoot>
802
				</tfoot>
803
				</table>
804
				<a onclick="javascript:addRowTo('maintable', 'formfldalias'); return false;" href="#">
805
					<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="<?=gettext("add another entry");?>" />
806
				</a>
807
				<script type="text/javascript">
808
					field_counter_js = 2;
809
					rows = 1;
810
					totalrows = <?php echo $counter; ?>;
811
					loaded = <?php echo $counter; ?>;
812
				</script>
813
				</div>
814
815
				</td>
816
			</tr>
817
			<tr>
818
			<td width="22%" valign="top">&nbsp;</td>
819
			<td width="78%">
820
				<input name="if" type="hidden" value="<?=$if;?>">
821 2fb056d8 Seth Mos
				<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="enable_change(true)">
822 99caa67c Seth Mos
			</td>
823
			</tr>
824
			<tr>
825
			<td width="22%" valign="top">&nbsp;</td>
826
			<td width="78%"> <p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br>
827
				</strong></span><?=gettext("The DNS servers entered in"); ?> <a href="system.php"><?=gettext("System: " .
828
				"General setup"); ?></a> <?=gettext("(or the"); ?> <a href="services_dnsmasq.php"><?=gettext("DNS " .
829
				"forwarder"); ?></a>, <?=gettext("if enabled)"); ?> </span><span class="vexpl"><?=gettext("will " .
830
				"be assigned to clients by the DHCP server."); ?><br>
831
				<br>
832 bfb00534 jim-p
				<?=gettext("The DHCP lease table can be viewed on the"); ?> <a href="status_dhcpv6_leases.php"><?=gettext("Status: " .
833
				"DHCPv6 leases"); ?></a> <?=gettext("page."); ?><br>
834 99caa67c Seth Mos
				</span></p>
835
			</td>
836
			</tr>
837
		</table>
838
		<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
839 f2ea45ef jim-p
		<tr>
840
			<td colspan="4" valign="top" class="listtopic"><?=gettext("DHCPv6 Static Mappings for this interface.");?></td>
841
			<td>&nbsp;</td>
842
		</tr>
843 99caa67c Seth Mos
		<tr>
844 2fb056d8 Seth Mos
			<td width="25%" class="listhdrr"><?=gettext("DUID");?></td>
845
			<td width="15%" class="listhdrr"><?=gettext("IPv6 address");?></td>
846 99caa67c Seth Mos
			<td width="20%" class="listhdrr"><?=gettext("Hostname");?></td>
847
			<td width="30%" class="listhdr"><?=gettext("Description");?></td>
848
			<td width="10%" class="list">
849
			<table border="0" cellspacing="0" cellpadding="1">
850
			<tr>
851
			<td valign="middle" width="17"></td>
852 aed47758 Seth Mos
			<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"></a></td>
853 99caa67c Seth Mos
			</tr>
854
			</table>
855
			</td>
856
		</tr>
857
			<?php if(is_array($a_maps)): ?>
858
			<?php $i = 0; foreach ($a_maps as $mapent): ?>
859 2fb056d8 Seth Mos
			<?php if($mapent['duid'] <> "" or $mapent['ipaddrv6'] <> ""): ?>
860 99caa67c Seth Mos
		<tr>
861 aed47758 Seth Mos
		<td class="listlr" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
862 2fb056d8 Seth Mos
			<?=htmlspecialchars($mapent['duid']);?>
863 99caa67c Seth Mos
		</td>
864 aed47758 Seth Mos
		<td class="listr" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
865 4e8e7662 Seth Mos
			<?=htmlspecialchars($mapent['ipaddrv6']);?>&nbsp;
866 99caa67c Seth Mos
		</td>
867 aed47758 Seth Mos
		<td class="listr" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
868 99caa67c Seth Mos
			<?=htmlspecialchars($mapent['hostname']);?>&nbsp;
869
		</td>
870 aed47758 Seth Mos
		<td class="listbg" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
871 99caa67c Seth Mos
			<?=htmlspecialchars($mapent['descr']);?>&nbsp;
872
		</td>
873 1c8dbfbb Darren Embry
		<td valign="middle" nowrap="nowrap" class="list">
874 99caa67c Seth Mos
			<table border="0" cellspacing="0" cellpadding="1">
875
			<tr>
876 aed47758 Seth Mos
			<td valign="middle"><a href="services_dhcpv6_edit.php?if=<?=$if;?>&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
877 d2627d7c Seth Mos
			<td valign="middle"><a href="services_dhcpv6.php?if=<?=$if;?>&act=del&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"></a></td>
878 99caa67c Seth Mos
			</tr>
879
			</table>
880
		</td>
881
		</tr>
882
		<?php endif; ?>
883
		<?php $i++; endforeach; ?>
884
		<?php endif; ?>
885
		<tr>
886
		<td class="list" colspan="4"></td>
887
		<td class="list">
888
			<table border="0" cellspacing="0" cellpadding="1">
889
			<tr>
890
			<td valign="middle" width="17"></td>
891 aed47758 Seth Mos
			<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"></a></td>
892 99caa67c Seth Mos
			</tr>
893
			</table>
894
		</td>
895
		</tr>
896
		</table>
897
	</div>
898
</td>
899
</tr>
900
</table>
901
</form>
902
<script language="JavaScript">
903
<!--
904
enable_change(false);
905
//-->
906
</script>
907
<?php include("fend.inc"); ?>
908
</body>
909
</html>