Project

General

Profile

Download (39.4 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 c7281770 Chris Buechler
	part of pfSense (https://www.pfsense.org)
11 99caa67c Seth Mos
	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 6f3d2063 Renato Botelho
	header("Location: /");
52 99caa67c Seth Mos
	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 ee9530e1 Colin Fleming
	$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 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 3d88ea11 Phil Davis
	list($pconfig['dns1'],$pconfig['dns2'],$pconfig['dns3'],$pconfig['dns4']) = $config['dhcpdv6'][$if]['dnsserver'];
110 99caa67c Seth Mos
	$pconfig['enable'] = isset($config['dhcpdv6'][$if]['enable']);
111
	$pconfig['ddnsdomain'] = $config['dhcpdv6'][$if]['ddnsdomain'];
112 87019fc4 Andres Petralli
	$pconfig['ddnsdomainprimary'] = $config['dhcpdv6'][$if]['ddnsdomainprimary'];
113
	$pconfig['ddnsdomainkeyname'] = $config['dhcpdv6'][$if]['ddnsdomainkeyname'];
114
	$pconfig['ddnsdomainkey'] = $config['dhcpdv6'][$if]['ddnsdomainkey'];
115 99caa67c Seth Mos
	$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 bd942860 Renato Botelho
	$pconfig['bootfile_url'] = $config['dhcpdv6'][$if]['bootfile_url'];
121 99caa67c Seth Mos
	$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 3d88ea11 Phil Davis
		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 99caa67c Seth Mos
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 87019fc4 Andres Petralli
		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 a3de8b9e Pierre POMES
		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 99caa67c Seth Mos
		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 bd942860 Renato Botelho
		if (($_POST['bootfile_url'] && !is_URL($_POST['bootfile_url'])))
218
			$input_errors[] = gettext("A valid URL must be specified for the network bootfile.");
219 99caa67c Seth Mos
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 41b4867e Renato Botelho
					if($vip['subnetv6'] && is_inrange_v6($vip['subnetv6'], $_POST['range_from'], $_POST['range_to']))
225 99caa67c Seth Mos
						$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 16d9ad13 smos
			if (is_ipaddrv6($ifcfgip)) {
240 41b4867e Renato Botelho
				if ((! is_inrange_v6($_POST['range_from'], $subnet_start, $subnet_end)) ||
241
			   	 (! is_inrange_v6($_POST['range_to'], $subnet_start, $subnet_end))) {
242 16d9ad13 smos
					$input_errors[] = gettext("The specified range lies outside of the current subnet.");
243
				}
244 99caa67c Seth Mos
			}
245 731de711 Pierre POMES
			/* "from" cannot be higher than "to" */
246
			if (inet_pton($_POST['range_from']) > inet_pton($_POST['range_to']))
247 99caa67c Seth Mos
				$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 731de711 Pierre POMES
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 99caa67c Seth Mos
			if(is_array($a_maps)) {
261
				foreach ($a_maps as $map) {
262
					if (empty($map['ipaddrv6']))
263
						continue;
264 731de711 Pierre POMES
					if ((inet_pton($map['ipaddrv6']) > $dynsubnet_start) &&
265 17aa0c18 Pierre POMES
						(inet_pton($map['ipaddrv6']) < $dynsubnet_end)) {
266 99caa67c Seth Mos
						$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 bfb3e717 Seth Mos
		if (!is_array($config['dhcpdv6'][$if]['prefixrange']))
280
			$config['dhcpdv6'][$if]['prefixrange'] = array();
281 99caa67c Seth Mos
282
		$config['dhcpdv6'][$if]['range']['from'] = $_POST['range_from'];
283
		$config['dhcpdv6'][$if]['range']['to'] = $_POST['range_to'];
284 bfb3e717 Seth Mos
		$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 99caa67c Seth Mos
		$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 3d88ea11 Phil Davis
		if ($_POST['dns3'])
299
			$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns3'];
300
		if ($_POST['dns4'])
301
			$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns4'];
302 99caa67c Seth Mos
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 87019fc4 Andres Petralli
		$config['dhcpdv6'][$if]['ddnsdomainprimary'] = $_POST['ddnsdomainprimary'];
308
		$config['dhcpdv6'][$if]['ddnsdomainkeyname'] = $_POST['ddnsdomainkeyname'];
309
		$config['dhcpdv6'][$if]['ddnsdomainkey'] = $_POST['ddnsdomainkey'];
310 99caa67c Seth Mos
		$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 bd942860 Renato Botelho
		$config['dhcpdv6'][$if]['bootfile_url'] = $_POST['bootfile_url'];
322 138208bf Joecowboy
		$config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'] = $_POST['dhcpv6leaseinlocaltime'];
323 99caa67c Seth Mos
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 e074fb75 Renato Botelho
		killbypid("{$g['dhcpd_chroot_path']}{$g['varrun_path']}/dhcpdv6.pid");
337 2fb056d8 Seth Mos
		// dhcp_clean_leases();
338 99caa67c Seth Mos
		/* dnsmasq_configure calls dhcpd_configure */
339
		/* no need to restart dhcpd twice */
340 ea1aca13 Renato Botelho
		if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic']))	{
341 99caa67c Seth Mos
			$retvaldns = services_dnsmasq_configure();
342
			if ($retvaldns == 0) {
343
				clear_subsystem_dirty('hosts');
344
				clear_subsystem_dirty('staticmaps');
345
			}
346 d939c1d4 Warren Baker
		} 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 99caa67c Seth Mos
		} else {
351
			$retvaldhcp = services_dhcpd_configure();
352
			if ($retvaldhcp == 0)
353
				clear_subsystem_dirty('staticmaps');
354
		}
355 472ad9a0 Renato Botelho
		if ($dhcpdv6_enable_changed)
356
			$retvalfc = filter_configure();
357
		if($retvaldhcp == 1 || $retvaldns == 1 || $retvalfc == 1)
358 99caa67c Seth Mos
			$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 ea1aca13 Renato Botelho
			if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstaticv6']))
370 99caa67c Seth Mos
				mark_subsystem_dirty('hosts');
371
		}
372
		header("Location: services_dhcpv6.php?if={$if}");
373
		exit;
374
	}
375
}
376
377 ee9530e1 Colin Fleming
$closehead = false;
378 99caa67c Seth Mos
$pgtitle = array(gettext("Services"),gettext("DHCPv6 server"));
379 b32dd0a6 jim-p
$shortcut_section = "dhcp6";
380 99caa67c Seth Mos
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 ee9530e1 Colin Fleming
//<![CDATA[
390 99caa67c Seth Mos
	rowname[0] = "number";
391
	rowtype[0] = "textbox";
392
	rowsize[0] = "10";
393
	rowname[1] = "value";
394
	rowtype[1] = "textbox";
395
	rowsize[1] = "55";
396 ee9530e1 Colin Fleming
//]]>
397 99caa67c Seth Mos
</script>
398
399 91f026b0 ayvis
<script type="text/javascript">
400 ee9530e1 Colin Fleming
//<![CDATA[
401 2fb056d8 Seth Mos
	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 bfb3e717 Seth Mos
		document.iform.prefixrange_from.disabled = endis;
407
		document.iform.prefixrange_to.disabled = endis;
408
		document.iform.prefixrange_length.disabled = endis;
409 2fb056d8 Seth Mos
		document.iform.dns1.disabled = endis;
410
		document.iform.dns2.disabled = endis;
411 3d88ea11 Phil Davis
		document.iform.dns3.disabled = endis;
412
		document.iform.dns4.disabled = endis;
413 2fb056d8 Seth Mos
		document.iform.deftime.disabled = endis;
414
		document.iform.maxtime.disabled = endis;
415 adaa3f75 Joecowboy
		//document.iform.gateway.disabled = endis;
416 138208bf Joecowboy
		document.iform.dhcpv6leaseinlocaltime.disabled = endis;
417 2fb056d8 Seth Mos
		document.iform.domain.disabled = endis;
418
		document.iform.domainsearchlist.disabled = endis;
419
		document.iform.ddnsdomain.disabled = endis;
420 87019fc4 Andres Petralli
		document.iform.ddnsdomainprimary.disabled = endis;
421
		document.iform.ddnsdomainkeyname.disabled = endis;
422
		document.iform.ddnsdomainkey.disabled = endis;
423 2fb056d8 Seth Mos
		document.iform.ddnsupdate.disabled = endis;
424 4096fe5d smos
		document.iform.ntp1.disabled = endis;
425
		document.iform.ntp2.disabled = endis;
426 adaa3f75 Joecowboy
		//document.iform.tftp.disabled = endis;
427 2fb056d8 Seth Mos
		document.iform.ldap.disabled = endis;
428
		document.iform.netboot.disabled = endis;
429 bd942860 Renato Botelho
		document.iform.bootfile_url.disabled = endis;
430 99caa67c Seth Mos
	}
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 7d504365 smos
	/*
449 99caa67c Seth Mos
	function show_tftp_config() {
450
		document.getElementById("showtftpbox").innerHTML='';
451
		aodiv = document.getElementById('showtftp');
452
		aodiv.style.display = "block";
453
	}
454 7d504365 smos
	*/
455 99caa67c Seth Mos
	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 ee9530e1 Colin Fleming
//]]>
467 99caa67c Seth Mos
</script>
468 ee9530e1 Colin Fleming
</head>
469 99caa67c Seth Mos
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 8cd558b6 ayvis
<?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 99caa67c Seth Mos
<?php endif; ?>
487 ee9530e1 Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="dhcpv6 server">
488 99caa67c Seth Mos
<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 db7a628c Renato Botelho
		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 99caa67c Seth Mos
			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 16d9ad13 smos
	/* 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 99caa67c Seth Mos
	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 1c8dbfbb Darren Embry
<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 99caa67c Seth Mos
<tr>
541
<td>
542
	<div id="mainarea">
543 ee9530e1 Colin Fleming
		<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
544 fe838158 smos
		<tr>
545
			<td width="22%" valign="top" class="vncellreq"><?=gettext("DHCPv6 Server");?></td>
546 2fb056d8 Seth Mos
			<td width="78%" class="vtable">
547 ee9530e1 Colin Fleming
				<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onclick="enable_change(false);" />
548 2fb056d8 Seth Mos
			<strong><?php printf(gettext("Enable DHCPv6 server on " .
549
			"%s " .
550
			"interface"),htmlspecialchars($iflist[$if]));?></strong></td>
551
			</tr>
552 16d9ad13 smos
			<?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 1edd5d22 Colin Fleming
			<tr>
557 99caa67c Seth Mos
			<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 47335ae3 Pierre POMES
				$range_to = gen_subnetv6_max($ifcfgip, $ifcfgsn);
580 99caa67c Seth Mos
				echo $range_to;
581
			?>
582
			</td>
583
			</tr>
584 16d9ad13 smos
			<?php } ?>
585
586 99caa67c Seth Mos
			<?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 8a3b09ef Seth Mos
				for ($i = 128; $i > 0; $i--) {
593
					if($i <> 127) {
594 99caa67c Seth Mos
						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 ee9530e1 Colin Fleming
				<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 99caa67c Seth Mos
			</td>
610
			</tr>
611
			<tr>
612 cd9fa56b Seth Mos
			<td width="22%" valign="top" class="vncell"><?=gettext("Prefix Delegation Range");?></td>
613 bfb3e717 Seth Mos
			<td width="78%" class="vtable">
614 ee9530e1 Colin Fleming
				<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 8cd558b6 ayvis
				&nbsp;<br /><?=gettext("Prefix Delegation Size"); ?>:&nbsp; <select name="prefixrange_length" class="formselect" id="prefixrange_length">
617 ee9530e1 Colin Fleming
					<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 8cd558b6 ayvis
				</select> <br />
625 bfb3e717 Seth Mos
				<?php echo gettext("You can define a Prefix range here for DHCP Prefix Delegation. This allows for 
626 e1cc1f6d smos
					assigning networks to subrouters. The start and end of the range must end on boundaries of the prefix delegation size."); ?>
627 bfb3e717 Seth Mos
			</td>
628
			</tr>
629
			<tr>
630 99caa67c Seth Mos
			<td width="22%" valign="top" class="vncell"><?=gettext("DNS servers");?></td>
631
			<td width="78%" class="vtable">
632 ee9530e1 Colin Fleming
				<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 3d88ea11 Phil Davis
				<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 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.");?>
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 ee9530e1 Colin Fleming
				<input name="domain" type="text" class="formfld unknown" id="domain" size="28" value="<?=htmlspecialchars($pconfig['domain']);?>" /><br />
643 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.");?>
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 ee9530e1 Colin Fleming
				<input name="domainsearchlist" type="text" class="formfld unknown" id="domainsearchlist" size="28" value="<?=htmlspecialchars($pconfig['domainsearchlist']);?>" /><br />
650 5aa68a55 Renato Botelho
				<?=gettext("The DHCP server can optionally provide a domain search list. Use the semicolon character as separator");?>
651 99caa67c Seth Mos
			</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 ee9530e1 Colin Fleming
				<input name="deftime" type="text" class="formfld unknown" id="deftime" size="10" value="<?=htmlspecialchars($pconfig['deftime']);?>" />
657 8cd558b6 ayvis
				<?=gettext("seconds");?><br />
658 99caa67c Seth Mos
				<?=gettext("This is used for clients that do not ask for a specific " .
659 8cd558b6 ayvis
				"expiration time."); ?><br />
660 99caa67c Seth Mos
				<?=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 ee9530e1 Colin Fleming
				<input name="maxtime" type="text" class="formfld unknown" id="maxtime" size="10" value="<?=htmlspecialchars($pconfig['maxtime']);?>" />
667 8cd558b6 ayvis
				<?=gettext("seconds");?><br />
668 99caa67c Seth Mos
				<?=gettext("This is the maximum lease time for clients that ask".
669 8cd558b6 ayvis
				" for a specific expiration time."); ?><br />
670 99caa67c Seth Mos
				<?=gettext("The default is 86400 seconds.");?>
671
			</td>
672
			</tr>
673 7d0ad4ec Joecowboy
			<tr>
674
				<td width="22%" valign="top" class="vncell"><?=gettext("Time format change"); ?></td>
675
				<td width="78%" class="vtable">
676 ee9530e1 Colin Fleming
				<table summary="time format change">
677 7d0ad4ec Joecowboy
					<tr>
678
					<td>
679 ee9530e1 Colin Fleming
						<input name="dhcpv6leaseinlocaltime" type="checkbox" id="dhcpv6leaseinlocaltime" value="yes" <?php if ($pconfig['dhcpv6leaseinlocaltime']) echo "checked=\"checked\""; ?> />
680 7d0ad4ec Joecowboy
					</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 99caa67c Seth Mos
			<tr>
699
			<td width="22%" valign="top" class="vncell"><?=gettext("Dynamic DNS");?></td>
700
			<td width="78%" class="vtable">
701
				<div id="showddnsbox">
702 ee9530e1 Colin Fleming
					<input type="button" onclick="show_ddns_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Dynamic DNS");?>
703 99caa67c Seth Mos
				</div>
704
				<div id="showddns" style="display:none">
705 ee9530e1 Colin Fleming
					<input style="vertical-align:middle" type="checkbox" value="yes" name="ddnsupdate" id="ddnsupdate" <?php if($pconfig['ddnsupdate']) echo " checked=\"checked\""; ?> />&nbsp;
706 99caa67c Seth Mos
					<b><?=gettext("Enable registration of DHCP client names in DNS.");?></b><br />
707
					<p>
708 ee9530e1 Colin Fleming
					<input name="ddnsdomain" type="text" class="formfld unknown" id="ddnsdomain" size="28" value="<?=htmlspecialchars($pconfig['ddnsdomain']);?>" /><br />
709 99caa67c Seth Mos
					<?=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 ee9530e1 Colin Fleming
					<input name="ddnsdomainprimary" type="text" class="formfld unknown" id="ddnsdomainprimary" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainprimary']);?>" /><br />
712 87019fc4 Andres Petralli
					<?=gettext("Enter the primary domain name server IP address for the dynamic domain name.");?><br />
713 ee9530e1 Colin Fleming
					<input name="ddnsdomainkeyname" type="text" class="formfld unknown" id="ddnsdomainkeyname" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainkeyname']);?>" /><br />
714 87019fc4 Andres Petralli
					<?=gettext("Enter the dynamic DNS domain key name which will be used to register client names in the DNS server.");?>
715 ee9530e1 Colin Fleming
					<input name="ddnsdomainkey" type="text" class="formfld unknown" id="ddnsdomainkey" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainkey']);?>" /><br />
716 87019fc4 Andres Petralli
					<?=gettext("Enter the dynamic DNS domain key secret which will be used to register client names in the DNS server.");?>
717 ee9530e1 Colin Fleming
					</p>
718 99caa67c Seth Mos
				</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 ee9530e1 Colin Fleming
					<input type="button" onclick="show_ntp_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show NTP configuration");?>
726 99caa67c Seth Mos
				</div>
727
				<div id="showntp" style="display:none">
728 ee9530e1 Colin Fleming
					<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 99caa67c Seth Mos
				</div>
731
			</td>
732
			</tr>
733 7d504365 smos
			<!-- ISC dhcpd does not support tftp for ipv6 yet. See redmine #2016
734 99caa67c Seth Mos
			<tr>
735
			<td width="22%" valign="top" class="vncell"><?=gettext("TFTP server");?></td>
736
			<td width="78%" class="vtable">
737
			<div id="showtftpbox">
738 ee9530e1 Colin Fleming
				<input type="button" onclick="show_tftp_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show TFTP configuration");?>
739 99caa67c Seth Mos
			</div>
740
			<div id="showtftp" style="display:none">
741 ee9530e1 Colin Fleming
				<input name="tftp" type="text" class="formfld unknown" id="tftp" size="50" value="<?=htmlspecialchars($pconfig['tftp']);?>" /><br />
742 99caa67c Seth Mos
				<?=gettext("Leave blank to disable.  Enter a full hostname or IP for the TFTP server.");?>
743
			</div>
744
			</td>
745
			</tr>
746 7d504365 smos
			-->
747 99caa67c Seth Mos
			<tr>
748
			<td width="22%" valign="top" class="vncell"><?=gettext("LDAP URI");?></td>
749
			<td width="78%" class="vtable">
750
				<div id="showldapbox">
751 ee9530e1 Colin Fleming
					<input type="button" onclick="show_ldap_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show LDAP configuration");?>
752 99caa67c Seth Mos
				</div>
753
				<div id="showldap" style="display:none">
754 ee9530e1 Colin Fleming
					<input name="ldap" type="text" class="formfld unknown" id="ldap" size="80" value="<?=htmlspecialchars($pconfig['ldap']);?>" /><br />
755 99caa67c Seth Mos
					<?=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 ee9530e1 Colin Fleming
					<input type="button" onclick="show_netboot_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Network booting");?>
764 99caa67c Seth Mos
				</div>
765
				<div id="shownetboot" style="display:none">
766 ee9530e1 Colin Fleming
					<input style="vertical-align:middle" type="checkbox" value="yes" name="netboot" id="netboot" <?php if($pconfig['netboot']) echo " checked=\"checked\""; ?> />&nbsp;
767 99caa67c Seth Mos
					<b><?=gettext("Enables network booting.");?></b>
768 1edd5d22 Colin Fleming
					<br/>
769 bd942860 Renato Botelho
					<?=gettext("Enter the Bootfile URL");?>
770 ee9530e1 Colin Fleming
					<input name="bootfile_url" type="text" class="formfld unknown" id="bootfile_url" size="28" value="<?=htmlspecialchars($pconfig['bootfile_url']);?>" />
771 99caa67c Seth Mos
				</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 ee9530e1 Colin Fleming
					<input type="button" onclick="show_shownumbervalue()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Additional BOOTP/DHCP Options");?>
779 99caa67c Seth Mos
				</div>
780
				<div id="shownumbervalue" style="display:none">
781 ee9530e1 Colin Fleming
				<table id="maintable" summary="bootp-dhcp options">
782 99caa67c Seth Mos
				<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 ee9530e1 Colin Fleming
					<?=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 99caa67c Seth Mos
					</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 ee9530e1 Colin Fleming
				//<![CDATA[
823 99caa67c Seth Mos
					field_counter_js = 2;
824
					rows = 1;
825
					totalrows = <?php echo $counter; ?>;
826
					loaded = <?php echo $counter; ?>;
827 ee9530e1 Colin Fleming
				//]]>
828 99caa67c Seth Mos
				</script>
829
				</div>
830
831
				</td>
832
			</tr>
833
			<tr>
834
			<td width="22%" valign="top">&nbsp;</td>
835
			<td width="78%">
836 ee9530e1 Colin Fleming
				<input name="if" type="hidden" value="<?=$if;?>" />
837
				<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="enable_change(true)" />
838 99caa67c Seth Mos
			</td>
839
			</tr>
840
			<tr>
841
			<td width="22%" valign="top">&nbsp;</td>
842 8cd558b6 ayvis
			<td width="78%"> <p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br />
843 99caa67c Seth Mos
				</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 8cd558b6 ayvis
				"be assigned to clients by the DHCP server."); ?><br />
847
				<br />
848 bfb00534 jim-p
				<?=gettext("The DHCP lease table can be viewed on the"); ?> <a href="status_dhcpv6_leases.php"><?=gettext("Status: " .
849 8cd558b6 ayvis
				"DHCPv6 leases"); ?></a> <?=gettext("page."); ?><br />
850 99caa67c Seth Mos
				</span></p>
851
			</td>
852
			</tr>
853
		</table>
854 ee9530e1 Colin Fleming
		<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="static mappings">
855 f2ea45ef jim-p
		<tr>
856
			<td colspan="4" valign="top" class="listtopic"><?=gettext("DHCPv6 Static Mappings for this interface.");?></td>
857
			<td>&nbsp;</td>
858
		</tr>
859 99caa67c Seth Mos
		<tr>
860 2fb056d8 Seth Mos
			<td width="25%" class="listhdrr"><?=gettext("DUID");?></td>
861
			<td width="15%" class="listhdrr"><?=gettext("IPv6 address");?></td>
862 99caa67c Seth Mos
			<td width="20%" class="listhdrr"><?=gettext("Hostname");?></td>
863
			<td width="30%" class="listhdr"><?=gettext("Description");?></td>
864
			<td width="10%" class="list">
865 ee9530e1 Colin Fleming
			<table border="0" cellspacing="0" cellpadding="1" summary="add">
866 99caa67c Seth Mos
			<tr>
867
			<td valign="middle" width="17"></td>
868 ee9530e1 Colin Fleming
			<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 99caa67c Seth Mos
			</tr>
870
			</table>
871
			</td>
872
		</tr>
873
			<?php if(is_array($a_maps)): ?>
874
			<?php $i = 0; foreach ($a_maps as $mapent): ?>
875 2fb056d8 Seth Mos
			<?php if($mapent['duid'] <> "" or $mapent['ipaddrv6'] <> ""): ?>
876 99caa67c Seth Mos
		<tr>
877 ee9530e1 Colin Fleming
		<td class="listlr" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&amp;id=<?=$i;?>';">
878 2fb056d8 Seth Mos
			<?=htmlspecialchars($mapent['duid']);?>
879 99caa67c Seth Mos
		</td>
880 ee9530e1 Colin Fleming
		<td class="listr" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&amp;id=<?=$i;?>';">
881 4e8e7662 Seth Mos
			<?=htmlspecialchars($mapent['ipaddrv6']);?>&nbsp;
882 99caa67c Seth Mos
		</td>
883 ee9530e1 Colin Fleming
		<td class="listr" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&amp;id=<?=$i;?>';">
884 99caa67c Seth Mos
			<?=htmlspecialchars($mapent['hostname']);?>&nbsp;
885
		</td>
886 ee9530e1 Colin Fleming
		<td class="listbg" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&amp;id=<?=$i;?>';">
887 99caa67c Seth Mos
			<?=htmlspecialchars($mapent['descr']);?>&nbsp;
888
		</td>
889 51bf0dbb Colin Fleming
		<td valign="middle" class="list nowrap">
890 ee9530e1 Colin Fleming
			<table border="0" cellspacing="0" cellpadding="1" summary="icons">
891 99caa67c Seth Mos
			<tr>
892 ee9530e1 Colin Fleming
			<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 99caa67c Seth Mos
			</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 ee9530e1 Colin Fleming
			<table border="0" cellspacing="0" cellpadding="1" summary="add">
905 99caa67c Seth Mos
			<tr>
906
			<td valign="middle" width="17"></td>
907 ee9530e1 Colin Fleming
			<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 99caa67c Seth Mos
			</tr>
909
			</table>
910
		</td>
911
		</tr>
912
		</table>
913
	</div>
914
</td>
915
</tr>
916
</table>
917
</form>
918 91f026b0 ayvis
<script type="text/javascript">
919 ee9530e1 Colin Fleming
//<![CDATA[
920 99caa67c Seth Mos
enable_change(false);
921 ee9530e1 Colin Fleming
//]]>
922 99caa67c Seth Mos
</script>
923
<?php include("fend.inc"); ?>
924
</body>
925
</html>