Project

General

Profile

Download (39.5 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 6317d31d Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
13 99caa67c Seth Mos
	All rights reserved.
14
15
	Redistribution and use in source and binary forms, with or without
16
	modification, are permitted provided that the following conditions are met:
17
18
	1. Redistributions of source code must retain the above copyright notice,
19
	   this list of conditions and the following disclaimer.
20
21
	2. Redistributions in binary form must reproduce the above copyright
22
	   notice, this list of conditions and the following disclaimer in the
23
	   documentation and/or other materials provided with the distribution.
24
25
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
26
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
29
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
	POSSIBILITY OF SUCH DAMAGE.
35
*/
36
/*
37
	pfSense_BUILDER_BINARIES:	/bin/rm
38
	pfSense_MODULE:	interfaces
39
*/
40
41
##|+PRIV
42
##|*IDENT=page-services-dhcpv6server
43
##|*NAME=Services: DHCPv6 server page
44
##|*DESCR=Allow access to the 'Services: DHCPv6 server' page.
45
##|*MATCH=services_dhcpv6.php*
46
##|-PRIV
47
48
require("guiconfig.inc");
49 472ad9a0 Renato Botelho
require_once("filter.inc");
50 99caa67c Seth Mos
51
if(!$g['services_dhcp_server_enable']) {
52 6f3d2063 Renato Botelho
	header("Location: /");
53 99caa67c Seth Mos
	exit;
54
}
55
56
/*  Fix failover DHCP problem
57
 *  http://article.gmane.org/gmane.comp.security.firewalls.pfsense.support/18749
58
 */
59
ini_set("memory_limit","64M");
60
61
$if = $_GET['if'];
62
if ($_POST['if'])
63
	$if = $_POST['if'];
64
65
/* if OLSRD is enabled, allow WAN to house DHCP. */
66
if($config['installedpackages']['olsrd']) {
67
	foreach($config['installedpackages']['olsrd']['config'] as $olsrd) {
68
			if($olsrd['enable']) {
69
				$is_olsr_enabled = true;
70
				break;
71
			}
72
	}
73
}
74
75
$iflist = get_configured_interface_with_descr();
76 16d9ad13 smos
$iflist = array_merge($iflist, get_configured_pppoe_server_interfaces());
77 99caa67c Seth Mos
78
/* set the starting interface */
79
if (!$if || !isset($iflist[$if])) {
80
	foreach ($iflist as $ifent => $ifname) {
81
		$oc = $config['interfaces'][$ifent];
82 db7a628c Renato Botelho
		if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
83
			(!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))))
84 99caa67c Seth Mos
			continue;
85
		$if = $ifent;
86
		break;
87
	}
88
}
89
90
if (is_array($config['dhcpdv6'][$if])){
91 fe838158 smos
	/* DHCPv6 */
92 99caa67c Seth Mos
	if (is_array($config['dhcpdv6'][$if]['range'])) {
93
		$pconfig['range_from'] = $config['dhcpdv6'][$if]['range']['from'];
94
		$pconfig['range_to'] = $config['dhcpdv6'][$if]['range']['to'];
95
	}
96 bfb3e717 Seth Mos
	if (is_array($config['dhcpdv6'][$if]['prefixrange'])) {
97
		$pconfig['prefixrange_from'] = $config['dhcpdv6'][$if]['prefixrange']['from'];
98
		$pconfig['prefixrange_to'] = $config['dhcpdv6'][$if]['prefixrange']['to'];
99
		$pconfig['prefixrange_length'] = $config['dhcpdv6'][$if]['prefixrange']['prefixlength'];
100
	}
101 99caa67c Seth Mos
	$pconfig['deftime'] = $config['dhcpdv6'][$if]['defaultleasetime'];
102
	$pconfig['maxtime'] = $config['dhcpdv6'][$if]['maxleasetime'];
103
	$pconfig['domain'] = $config['dhcpdv6'][$if]['domain'];
104
	$pconfig['domainsearchlist'] = $config['dhcpdv6'][$if]['domainsearchlist'];
105 13399e17 Seth Mos
	list($pconfig['wins1'],$pconfig['wins2']) = $config['dhcpdv6'][$if]['winsserver'];
106 3d88ea11 Phil Davis
	list($pconfig['dns1'],$pconfig['dns2'],$pconfig['dns3'],$pconfig['dns4']) = $config['dhcpdv6'][$if]['dnsserver'];
107 99caa67c Seth Mos
	$pconfig['enable'] = isset($config['dhcpdv6'][$if]['enable']);
108
	$pconfig['ddnsdomain'] = $config['dhcpdv6'][$if]['ddnsdomain'];
109 87019fc4 Andres Petralli
	$pconfig['ddnsdomainprimary'] = $config['dhcpdv6'][$if]['ddnsdomainprimary'];
110
	$pconfig['ddnsdomainkeyname'] = $config['dhcpdv6'][$if]['ddnsdomainkeyname'];
111
	$pconfig['ddnsdomainkey'] = $config['dhcpdv6'][$if]['ddnsdomainkey'];
112 99caa67c Seth Mos
	$pconfig['ddnsupdate'] = isset($config['dhcpdv6'][$if]['ddnsupdate']);
113
	list($pconfig['ntp1'],$pconfig['ntp2']) = $config['dhcpdv6'][$if]['ntpserver'];
114
	$pconfig['tftp'] = $config['dhcpdv6'][$if]['tftp'];
115
	$pconfig['ldap'] = $config['dhcpdv6'][$if]['ldap'];
116
	$pconfig['netboot'] = isset($config['dhcpdv6'][$if]['netboot']);
117 bd942860 Renato Botelho
	$pconfig['bootfile_url'] = $config['dhcpdv6'][$if]['bootfile_url'];
118 99caa67c Seth Mos
	$pconfig['netmask'] = $config['dhcpdv6'][$if]['netmask'];
119
	$pconfig['numberoptions'] = $config['dhcpdv6'][$if]['numberoptions'];
120 138208bf Joecowboy
	$pconfig['dhcpv6leaseinlocaltime'] = $config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'];
121 99caa67c Seth Mos
	if (!is_array($config['dhcpdv6'][$if]['staticmap']))
122
		$config['dhcpdv6'][$if]['staticmap'] = array();
123
	$a_maps = &$config['dhcpdv6'][$if]['staticmap'];
124
}
125
126
$ifcfgip = get_interface_ipv6($if);
127
$ifcfgsn = get_interface_subnetv6($if);
128
129
/*   set the enabled flag which will tell us if DHCP relay is enabled
130
 *   on any interface. We will use this to disable DHCP server since
131
 *   the two are not compatible with each other.
132
 */
133
134
$dhcrelay_enabled = false;
135 80c88a68 smos
$dhcrelaycfg = $config['dhcrelay6'];
136 99caa67c Seth Mos
137
if(is_array($dhcrelaycfg)) {
138
	foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) {
139
		if (isset($dhcrelayifconf['enable']) && isset($iflist[$dhcrelayif]) &&
140
			(!link_interface_to_bridge($dhcrelayif)))
141
			$dhcrelay_enabled = true;
142
	}
143
}
144
145
if ($_POST) {
146
147
	unset($input_errors);
148
149 472ad9a0 Renato Botelho
	$old_dhcpdv6_enable = ($pconfig['enable'] == true);
150
	$new_dhcpdv6_enable = ($_POST['enable'] ? true : false);
151
	$dhcpdv6_enable_changed = ($old_dhcpdv6_enable != $new_dhcpdv6_enable);
152
153 99caa67c Seth Mos
	$pconfig = $_POST;
154
155
	$numberoptions = array();
156
	for($x=0; $x<99; $x++) {
157
		if(isset($_POST["number{$x}"]) && ctype_digit($_POST["number{$x}"])) {
158
			$numbervalue = array();
159
			$numbervalue['number'] = htmlspecialchars($_POST["number{$x}"]);
160
			$numbervalue['value'] = htmlspecialchars($_POST["value{$x}"]);
161
			$numberoptions['item'][] = $numbervalue;
162
		}
163
	}
164
	// Reload the new pconfig variable that the forum uses.
165
	$pconfig['numberoptions'] = $numberoptions;
166
167
	/* input validation */
168
	if ($_POST['enable']) {
169
		$reqdfields = explode(" ", "range_from range_to");
170
		$reqdfieldsn = array(gettext("Range begin"),gettext("Range end"));
171
172 1e9b4611 Renato Botelho
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
173 99caa67c Seth Mos
174 bfb3e717 Seth Mos
		if (($_POST['prefixrange_from'] && !is_ipaddrv6($_POST['prefixrange_from'])))
175
			$input_errors[] = gettext("A valid range must be specified.");
176
		if (($_POST['prefixrange_to'] && !is_ipaddrv6($_POST['prefixrange_to'])))
177
			$input_errors[] = gettext("A valid prefix range must be specified.");
178 cd9fa56b Seth Mos
		if (($_POST['range_from'] && !is_ipaddrv6($_POST['range_from'])))
179 99caa67c Seth Mos
			$input_errors[] = gettext("A valid range must be specified.");
180
		if (($_POST['range_to'] && !is_ipaddrv6($_POST['range_to'])))
181
			$input_errors[] = gettext("A valid range must be specified.");
182
		if (($_POST['gateway'] && !is_ipaddrv6($_POST['gateway'])))
183
			$input_errors[] = gettext("A valid IPv6 address must be specified for the gateway.");
184 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'])))
185
			$input_errors[] = gettext("A valid IPv6 address must be specified for each of the DNS servers.");
186 99caa67c Seth Mos
187
		if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60)))
188
			$input_errors[] = gettext("The default lease time must be at least 60 seconds.");
189
		if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime'])))
190
			$input_errors[] = gettext("The maximum lease time must be at least 60 seconds and higher than the default lease time.");
191
		if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain'])))
192
			$input_errors[] = gettext("A valid domain name must be specified for the dynamic DNS registration.");
193 87019fc4 Andres Petralli
		if (($_POST['ddnsdomain'] && !is_ipaddrv4($_POST['ddnsdomainprimary'])))
194
			$input_errors[] = gettext("A valid primary domain name server IPv4 address must be specified for the dynamic domain name.");
195
		if (($_POST['ddnsdomainkey'] && !$_POST['ddnsdomainkeyname']) ||
196
			($_POST['ddnsdomainkeyname'] && !$_POST['ddnsdomainkey']))
197
			$input_errors[] = gettext("You must specify both a valid domain key and key name.");
198 a3de8b9e Pierre POMES
		if ($_POST['domainsearchlist']) {
199
			$domain_array=preg_split("/[ ;]+/",$_POST['domainsearchlist']);
200
			foreach ($domain_array as $curdomain) {
201
				if (!is_domain($curdomain)) {
202
					$input_errors[] = gettext("A valid domain search list must be specified.");
203
					break;
204
				}
205
			}
206
		}
207
208 99caa67c Seth Mos
		if (($_POST['ntp1'] && !is_ipaddrv6($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddrv6($_POST['ntp2'])))
209
			$input_errors[] = gettext("A valid IPv6 address must be specified for the primary/secondary NTP servers.");
210
		if (($_POST['domain'] && !is_domain($_POST['domain'])))
211
			$input_errors[] = gettext("A valid domain name must be specified for the DNS domain.");
212
		if ($_POST['tftp'] && !is_ipaddr($_POST['tftp']) && !is_domain($_POST['tftp']) && !is_URL($_POST['tftp']))
213
			$input_errors[] = gettext("A valid IPv6 address or hostname must be specified for the TFTP server.");
214 bd942860 Renato Botelho
		if (($_POST['bootfile_url'] && !is_URL($_POST['bootfile_url'])))
215
			$input_errors[] = gettext("A valid URL must be specified for the network bootfile.");
216 99caa67c Seth Mos
217
		// Disallow a range that includes the virtualip
218
		if (is_array($config['virtualip']['vip'])) {
219
			foreach($config['virtualip']['vip'] as $vip) {
220
				if($vip['interface'] == $if)
221 41b4867e Renato Botelho
					if($vip['subnetv6'] && is_inrange_v6($vip['subnetv6'], $_POST['range_from'], $_POST['range_to']))
222 99caa67c Seth Mos
						$input_errors[] = sprintf(gettext("The subnet range cannot overlap with virtual IPv6 address %s."),$vip['subnetv6']);
223
			}
224
		}
225
226
		$noip = false;
227
		if(is_array($a_maps))
228
			foreach ($a_maps as $map)
229
				if (empty($map['ipaddrv6']))
230
					$noip = true;
231
		if (!$input_errors) {
232
			/* make sure the range lies within the current subnet */
233
			$subnet_start = gen_subnetv6($ifcfgip, $ifcfgsn);
234
			$subnet_end = gen_subnetv6_max($ifcfgip, $ifcfgsn);
235
236 16d9ad13 smos
			if (is_ipaddrv6($ifcfgip)) {
237 41b4867e Renato Botelho
				if ((! is_inrange_v6($_POST['range_from'], $subnet_start, $subnet_end)) ||
238
			   	 (! is_inrange_v6($_POST['range_to'], $subnet_start, $subnet_end))) {
239 16d9ad13 smos
					$input_errors[] = gettext("The specified range lies outside of the current subnet.");
240
				}
241 99caa67c Seth Mos
			}
242 731de711 Pierre POMES
			/* "from" cannot be higher than "to" */
243
			if (inet_pton($_POST['range_from']) > inet_pton($_POST['range_to']))
244 99caa67c Seth Mos
				$input_errors[] = gettext("The range is invalid (first element higher than second element).");
245
246
			/* make sure that the DHCP Relay isn't enabled on this interface */
247
			if (isset($config['dhcrelay'][$if]['enable']))
248
				$input_errors[] = sprintf(gettext("You must disable the DHCP relay on the %s interface before enabling the DHCP server."),$iflist[$if]);
249
250 731de711 Pierre POMES
251
			/* Verify static mappings do not overlap:
252
			   - available DHCP range
253
			   - prefix delegation range (FIXME: still need to be completed) */
254
			$dynsubnet_start = inet_pton($_POST['range_from']);
255
			$dynsubnet_end = inet_pton($_POST['range_to']);
256
257 99caa67c Seth Mos
			if(is_array($a_maps)) {
258
				foreach ($a_maps as $map) {
259
					if (empty($map['ipaddrv6']))
260
						continue;
261 731de711 Pierre POMES
					if ((inet_pton($map['ipaddrv6']) > $dynsubnet_start) &&
262 17aa0c18 Pierre POMES
						(inet_pton($map['ipaddrv6']) < $dynsubnet_end)) {
263 99caa67c Seth Mos
						$input_errors[] = sprintf(gettext("The DHCP range cannot overlap any static DHCP mappings."));
264
						break;
265
					}
266
				}
267
			}
268
		}
269
	}
270
271
	if (!$input_errors) {
272
		if (!is_array($config['dhcpdv6'][$if]))
273
			$config['dhcpdv6'][$if] = array();
274
		if (!is_array($config['dhcpdv6'][$if]['range']))
275
			$config['dhcpdv6'][$if]['range'] = array();
276 bfb3e717 Seth Mos
		if (!is_array($config['dhcpdv6'][$if]['prefixrange']))
277
			$config['dhcpdv6'][$if]['prefixrange'] = array();
278 99caa67c Seth Mos
279
		$config['dhcpdv6'][$if]['range']['from'] = $_POST['range_from'];
280
		$config['dhcpdv6'][$if]['range']['to'] = $_POST['range_to'];
281 bfb3e717 Seth Mos
		$config['dhcpdv6'][$if]['prefixrange']['from'] = $_POST['prefixrange_from'];
282
		$config['dhcpdv6'][$if]['prefixrange']['to'] = $_POST['prefixrange_to'];
283
		$config['dhcpdv6'][$if]['prefixrange']['prefixlength'] = $_POST['prefixrange_length'];
284 99caa67c Seth Mos
		$config['dhcpdv6'][$if]['defaultleasetime'] = $_POST['deftime'];
285
		$config['dhcpdv6'][$if]['maxleasetime'] = $_POST['maxtime'];
286
		$config['dhcpdv6'][$if]['netmask'] = $_POST['netmask'];
287
288
		unset($config['dhcpdv6'][$if]['winsserver']);
289
290
		unset($config['dhcpdv6'][$if]['dnsserver']);
291
		if ($_POST['dns1'])
292
			$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns1'];
293
		if ($_POST['dns2'])
294
			$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns2'];
295 3d88ea11 Phil Davis
		if ($_POST['dns3'])
296
			$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns3'];
297
		if ($_POST['dns4'])
298
			$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns4'];
299 99caa67c Seth Mos
300
		$config['dhcpdv6'][$if]['domain'] = $_POST['domain'];
301
		$config['dhcpdv6'][$if]['domainsearchlist'] = $_POST['domainsearchlist'];
302
		$config['dhcpdv6'][$if]['enable'] = ($_POST['enable']) ? true : false;
303
		$config['dhcpdv6'][$if]['ddnsdomain'] = $_POST['ddnsdomain'];
304 87019fc4 Andres Petralli
		$config['dhcpdv6'][$if]['ddnsdomainprimary'] = $_POST['ddnsdomainprimary'];
305
		$config['dhcpdv6'][$if]['ddnsdomainkeyname'] = $_POST['ddnsdomainkeyname'];
306
		$config['dhcpdv6'][$if]['ddnsdomainkey'] = $_POST['ddnsdomainkey'];
307 99caa67c Seth Mos
		$config['dhcpdv6'][$if]['ddnsupdate'] = ($_POST['ddnsupdate']) ? true : false;
308
309
		unset($config['dhcpdv6'][$if]['ntpserver']);
310
		if ($_POST['ntp1'])
311
			$config['dhcpdv6'][$if]['ntpserver'][] = $_POST['ntp1'];
312
		if ($_POST['ntp2'])
313
			$config['dhcpdv6'][$if]['ntpserver'][] = $_POST['ntp2'];
314
315
		$config['dhcpdv6'][$if]['tftp'] = $_POST['tftp'];
316
		$config['dhcpdv6'][$if]['ldap'] = $_POST['ldap'];
317
		$config['dhcpdv6'][$if]['netboot'] = ($_POST['netboot']) ? true : false;
318 bd942860 Renato Botelho
		$config['dhcpdv6'][$if]['bootfile_url'] = $_POST['bootfile_url'];
319 138208bf Joecowboy
		$config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'] = $_POST['dhcpv6leaseinlocaltime'];
320 99caa67c Seth Mos
321
		// Handle the custom options rowhelper
322
		if(isset($config['dhcpdv6'][$if]['numberoptions']['item']))
323
			unset($config['dhcpdv6'][$if]['numberoptions']['item']);
324
325
		$config['dhcpdv6'][$if]['numberoptions'] = $numberoptions;
326
327
		write_config();
328
329
		$retval = 0;
330
		$retvaldhcp = 0;
331
		$retvaldns = 0;
332
		/* Stop DHCPv6 so we can cleanup leases */
333 e074fb75 Renato Botelho
		killbypid("{$g['dhcpd_chroot_path']}{$g['varrun_path']}/dhcpdv6.pid");
334 2fb056d8 Seth Mos
		// dhcp_clean_leases();
335 99caa67c Seth Mos
		/* dnsmasq_configure calls dhcpd_configure */
336
		/* no need to restart dhcpd twice */
337 ea1aca13 Renato Botelho
		if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic']))	{
338 99caa67c Seth Mos
			$retvaldns = services_dnsmasq_configure();
339
			if ($retvaldns == 0) {
340
				clear_subsystem_dirty('hosts');
341
				clear_subsystem_dirty('staticmaps');
342
			}
343 d939c1d4 Warren Baker
		} else if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
344
			$retvaldns = services_unbound_configure();
345 ca9a4e2b Robert Nelson
			if ($retvaldns == 0) {
346 d939c1d4 Warren Baker
				clear_subsystem_dirty('unbound');
347 ca9a4e2b Robert Nelson
				clear_subsystem_dirty('staticmaps');
348
			}
349 99caa67c Seth Mos
		} else {
350
			$retvaldhcp = services_dhcpd_configure();
351
			if ($retvaldhcp == 0)
352
				clear_subsystem_dirty('staticmaps');
353
		}
354 472ad9a0 Renato Botelho
		if ($dhcpdv6_enable_changed)
355
			$retvalfc = filter_configure();
356
		if($retvaldhcp == 1 || $retvaldns == 1 || $retvalfc == 1)
357 99caa67c Seth Mos
			$retval = 1;
358
		$savemsg = get_std_save_message($retval);
359
	}
360
}
361
362
if ($_GET['act'] == "del") {
363
	if ($a_maps[$_GET['id']]) {
364
		unset($a_maps[$_GET['id']]);
365
		write_config();
366
		if(isset($config['dhcpdv6'][$if]['enable'])) {
367
			mark_subsystem_dirty('staticmapsv6');
368 ea1aca13 Renato Botelho
			if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstaticv6']))
369 99caa67c Seth Mos
				mark_subsystem_dirty('hosts');
370
		}
371
		header("Location: services_dhcpv6.php?if={$if}");
372
		exit;
373
	}
374
}
375
376 ee9530e1 Colin Fleming
$closehead = false;
377 99caa67c Seth Mos
$pgtitle = array(gettext("Services"),gettext("DHCPv6 server"));
378 b32dd0a6 jim-p
$shortcut_section = "dhcp6";
379 99caa67c Seth Mos
380
include("head.inc");
381
382
?>
383
384
<script type="text/javascript" src="/javascript/row_helper.js">
385
</script>
386
387
<script type="text/javascript">
388 ee9530e1 Colin Fleming
//<![CDATA[
389 99caa67c Seth Mos
	rowname[0] = "number";
390
	rowtype[0] = "textbox";
391
	rowsize[0] = "10";
392
	rowname[1] = "value";
393
	rowtype[1] = "textbox";
394
	rowsize[1] = "55";
395 ee9530e1 Colin Fleming
//]]>
396 99caa67c Seth Mos
</script>
397
398 91f026b0 ayvis
<script type="text/javascript">
399 ee9530e1 Colin Fleming
//<![CDATA[
400 2fb056d8 Seth Mos
	function enable_change(enable_over) {
401
		var endis;
402
		endis = !(document.iform.enable.checked || enable_over);
403
		document.iform.range_from.disabled = endis;
404
		document.iform.range_to.disabled = endis;
405 bfb3e717 Seth Mos
		document.iform.prefixrange_from.disabled = endis;
406
		document.iform.prefixrange_to.disabled = endis;
407
		document.iform.prefixrange_length.disabled = endis;
408 2fb056d8 Seth Mos
		document.iform.dns1.disabled = endis;
409
		document.iform.dns2.disabled = endis;
410 3d88ea11 Phil Davis
		document.iform.dns3.disabled = endis;
411
		document.iform.dns4.disabled = endis;
412 2fb056d8 Seth Mos
		document.iform.deftime.disabled = endis;
413
		document.iform.maxtime.disabled = endis;
414 adaa3f75 Joecowboy
		//document.iform.gateway.disabled = endis;
415 138208bf Joecowboy
		document.iform.dhcpv6leaseinlocaltime.disabled = endis;
416 2fb056d8 Seth Mos
		document.iform.domain.disabled = endis;
417
		document.iform.domainsearchlist.disabled = endis;
418
		document.iform.ddnsdomain.disabled = endis;
419 87019fc4 Andres Petralli
		document.iform.ddnsdomainprimary.disabled = endis;
420
		document.iform.ddnsdomainkeyname.disabled = endis;
421
		document.iform.ddnsdomainkey.disabled = endis;
422 2fb056d8 Seth Mos
		document.iform.ddnsupdate.disabled = endis;
423 4096fe5d smos
		document.iform.ntp1.disabled = endis;
424
		document.iform.ntp2.disabled = endis;
425 adaa3f75 Joecowboy
		//document.iform.tftp.disabled = endis;
426 2fb056d8 Seth Mos
		document.iform.ldap.disabled = endis;
427
		document.iform.netboot.disabled = endis;
428 bd942860 Renato Botelho
		document.iform.bootfile_url.disabled = endis;
429 99caa67c Seth Mos
	}
430
431
	function show_shownumbervalue() {
432
		document.getElementById("shownumbervaluebox").innerHTML='';
433
		aodiv = document.getElementById('shownumbervalue');
434
		aodiv.style.display = "block";
435
	}
436
437
	function show_ddns_config() {
438
		document.getElementById("showddnsbox").innerHTML='';
439
		aodiv = document.getElementById('showddns');
440
		aodiv.style.display = "block";
441
	}
442
	function show_ntp_config() {
443
		document.getElementById("showntpbox").innerHTML='';
444
		aodiv = document.getElementById('showntp');
445
		aodiv.style.display = "block";
446
	}
447 7d504365 smos
	/*
448 99caa67c Seth Mos
	function show_tftp_config() {
449
		document.getElementById("showtftpbox").innerHTML='';
450
		aodiv = document.getElementById('showtftp');
451
		aodiv.style.display = "block";
452
	}
453 7d504365 smos
	*/
454 99caa67c Seth Mos
	function show_ldap_config() {
455
		document.getElementById("showldapbox").innerHTML='';
456
		aodiv = document.getElementById('showldap');
457
		aodiv.style.display = "block";
458
	}
459
460
	function show_netboot_config() {
461
		document.getElementById("shownetbootbox").innerHTML='';
462
		aodiv = document.getElementById('shownetboot');
463
		aodiv.style.display = "block";
464
	}
465 ee9530e1 Colin Fleming
//]]>
466 99caa67c Seth Mos
</script>
467 ee9530e1 Colin Fleming
</head>
468 99caa67c Seth Mos
469
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
470
<?php include("fbegin.inc"); ?>
471
<form action="services_dhcpv6.php" method="post" name="iform" id="iform">
472
<?php if ($input_errors) print_input_errors($input_errors); ?>
473
<?php if ($savemsg) print_info_box($savemsg); ?>
474
<?php
475
	if ($dhcrelay_enabled) {
476
		echo gettext("DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.");
477
		include("fend.inc");
478
		echo "</body>";
479
		echo "</html>";
480
		exit;
481
	}
482
?>
483
<?php if (is_subsystem_dirty('staticmaps')): ?><p>
484 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 />
485 99caa67c Seth Mos
<?php endif; ?>
486 ee9530e1 Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="dhcpv6 server">
487 99caa67c Seth Mos
<tr><td>
488
<?php
489
	/* active tabs */
490
	$tab_array = array();
491
	$tabscounter = 0;
492
	$i = 0;
493
	foreach ($iflist as $ifent => $ifname) {
494
		$oc = $config['interfaces'][$ifent];
495 db7a628c Renato Botelho
		if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
496
			(!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))))
497 99caa67c Seth Mos
			continue;
498
		if ($ifent == $if)
499
			$active = true;
500
		else
501
			$active = false;
502
		$tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}");
503
		$tabscounter++;
504
	}
505 16d9ad13 smos
	/* tack on PPPoE or PPtP servers here */
506
	/* pppoe server */
507
	if (is_array($config['pppoes']['pppoe'])) {
508
		foreach($config['pppoes']['pppoe'] as $pppoe) {
509
			if ($pppoe['mode'] == "server") {
510
				$ifent = "poes". $pppoe['pppoeid'];
511
				$ifname = strtoupper($ifent);
512
				if ($ifent == $if)
513
					$active = true;
514
				else
515
					$active = false;
516
				$tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}");
517
				$tabscounter++;
518
			}
519
		}
520
	}
521 99caa67c Seth Mos
	if ($tabscounter == 0) {
522 4e82cebf Chris Buechler
		echo "<b>" . gettext("The DHCPv6 Server can only be enabled on interfaces configured with a static IPv6 address. This system has none.") . "<br/><br/>";
523 99caa67c Seth Mos
		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
				echo $range_from;
574
575
			?>
576
			-
577
			<?php
578 47335ae3 Pierre POMES
				$range_to = gen_subnetv6_max($ifcfgip, $ifcfgsn);
579 99caa67c Seth Mos
				echo $range_to;
580
			?>
581
			</td>
582
			</tr>
583 16d9ad13 smos
			<?php } ?>
584
585 99caa67c Seth Mos
			<?php if($is_olsr_enabled): ?>
586
			<tr>
587
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet Mask");?></td>
588
			<td width="78%" class="vtable">
589
				<select name="netmask" class="formselect" id="netmask">
590
				<?php
591 8a3b09ef Seth Mos
				for ($i = 128; $i > 0; $i--) {
592
					if($i <> 127) {
593 99caa67c Seth Mos
						echo "<option value=\"{$i}\" ";
594
						if ($i == $pconfig['netmask']) echo "selected";
595
						echo ">" . $i . "</option>";
596
					}
597
				}
598
				?>
599
				</select>
600
			</td>
601
			</tr>
602
			<?php endif; ?>
603
			<tr>
604
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Range");?></td>
605
			<td width="78%" class="vtable">
606 ee9530e1 Colin Fleming
				<input name="range_from" type="text" class="formfld unknown" id="range_from" size="28" value="<?=htmlspecialchars($pconfig['range_from']);?>" />
607
				&nbsp;<?=gettext("to"); ?>&nbsp; <input name="range_to" type="text" class="formfld unknown" id="range_to" size="28" value="<?=htmlspecialchars($pconfig['range_to']);?>" />
608 99caa67c Seth Mos
			</td>
609
			</tr>
610
			<tr>
611 cd9fa56b Seth Mos
			<td width="22%" valign="top" class="vncell"><?=gettext("Prefix Delegation Range");?></td>
612 bfb3e717 Seth Mos
			<td width="78%" class="vtable">
613 ee9530e1 Colin Fleming
				<input name="prefixrange_from" type="text" class="formfld unknown" id="prefixrange_from" size="28" value="<?=htmlspecialchars($pconfig['prefixrange_from']);?>" />
614
				&nbsp;<?=gettext("to"); ?>&nbsp; <input name="prefixrange_to" type="text" class="formfld unknown" id="prefixrange_to" size="28" value="<?=htmlspecialchars($pconfig['prefixrange_to']);?>" />
615 8cd558b6 ayvis
				&nbsp;<br /><?=gettext("Prefix Delegation Size"); ?>:&nbsp; <select name="prefixrange_length" class="formselect" id="prefixrange_length">
616 ee9530e1 Colin Fleming
					<option value="48" <?php if($pconfig['prefixrange_length'] == 48) echo "selected=\"selected\""; ?>>48</option>
617
					<option value="52" <?php if($pconfig['prefixrange_length'] == 52) echo "selected=\"selected\""; ?>>52</option>
618
					<option value="56" <?php if($pconfig['prefixrange_length'] == 56) echo "selected=\"selected\""; ?>>56</option>
619
					<option value="60" <?php if($pconfig['prefixrange_length'] == 60) echo "selected=\"selected\""; ?>>60</option>
620
					<option value="62" <?php if($pconfig['prefixrange_length'] == 62) echo "selected=\"selected\""; ?>>62</option>
621
					<option value="63" <?php if($pconfig['prefixrange_length'] == 63) echo "selected=\"selected\""; ?>>63</option>
622
					<option value="64" <?php if($pconfig['prefixrange_length'] == 64) echo "selected=\"selected\""; ?>>64</option>
623 8cd558b6 ayvis
				</select> <br />
624 bfb3e717 Seth Mos
				<?php echo gettext("You can define a Prefix range here for DHCP Prefix Delegation. This allows for 
625 e1cc1f6d smos
					assigning networks to subrouters. The start and end of the range must end on boundaries of the prefix delegation size."); ?>
626 bfb3e717 Seth Mos
			</td>
627
			</tr>
628
			<tr>
629 99caa67c Seth Mos
			<td width="22%" valign="top" class="vncell"><?=gettext("DNS servers");?></td>
630
			<td width="78%" class="vtable">
631 ee9530e1 Colin Fleming
				<input name="dns1" type="text" class="formfld unknown" id="dns1" size="28" value="<?=htmlspecialchars($pconfig['dns1']);?>" /><br />
632
				<input name="dns2" type="text" class="formfld unknown" id="dns2" size="28" value="<?=htmlspecialchars($pconfig['dns2']);?>" /><br />
633 3d88ea11 Phil Davis
				<input name="dns3" type="text" class="formfld unknown" id="dns3" size="28" value="<?=htmlspecialchars($pconfig['dns3']);?>" /><br />
634
				<input name="dns4" type="text" class="formfld unknown" id="dns4" size="28" value="<?=htmlspecialchars($pconfig['dns4']);?>" /><br />
635 796cc218 Chris Buechler
				<?=gettext("NOTE: leave blank to use the system default DNS servers - this interface's IP if DNS Forwarder or Resolver is enabled, otherwise the servers configured on the General page.");?>
636 99caa67c Seth Mos
			</td>
637
			</tr>
638
			<tr>
639
			<td width="22%" valign="top" class="vncell"><?=gettext("Domain name");?></td>
640
			<td width="78%" class="vtable">
641 ee9530e1 Colin Fleming
				<input name="domain" type="text" class="formfld unknown" id="domain" size="28" value="<?=htmlspecialchars($pconfig['domain']);?>" /><br />
642 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.");?>
643
			 </td>
644
			</tr>
645
			<tr>
646
			<td width="22%" valign="top" class="vncell"><?=gettext("Domain search list");?></td>
647
			<td width="78%" class="vtable">
648 ee9530e1 Colin Fleming
				<input name="domainsearchlist" type="text" class="formfld unknown" id="domainsearchlist" size="28" value="<?=htmlspecialchars($pconfig['domainsearchlist']);?>" /><br />
649 5aa68a55 Renato Botelho
				<?=gettext("The DHCP server can optionally provide a domain search list. Use the semicolon character as separator");?>
650 99caa67c Seth Mos
			</td>
651
			</tr>
652
			<tr>
653
			<td width="22%" valign="top" class="vncell"><?=gettext("Default lease time");?></td>
654
			<td width="78%" class="vtable">
655 ee9530e1 Colin Fleming
				<input name="deftime" type="text" class="formfld unknown" id="deftime" size="10" value="<?=htmlspecialchars($pconfig['deftime']);?>" />
656 8cd558b6 ayvis
				<?=gettext("seconds");?><br />
657 99caa67c Seth Mos
				<?=gettext("This is used for clients that do not ask for a specific " .
658 8cd558b6 ayvis
				"expiration time."); ?><br />
659 99caa67c Seth Mos
				<?=gettext("The default is 7200 seconds.");?>
660
			</td>
661
			</tr>
662
			<tr>
663
			<td width="22%" valign="top" class="vncell"><?=gettext("Maximum lease time");?></td>
664
			<td width="78%" class="vtable">
665 ee9530e1 Colin Fleming
				<input name="maxtime" type="text" class="formfld unknown" id="maxtime" size="10" value="<?=htmlspecialchars($pconfig['maxtime']);?>" />
666 8cd558b6 ayvis
				<?=gettext("seconds");?><br />
667 99caa67c Seth Mos
				<?=gettext("This is the maximum lease time for clients that ask".
668 8cd558b6 ayvis
				" for a specific expiration time."); ?><br />
669 99caa67c Seth Mos
				<?=gettext("The default is 86400 seconds.");?>
670
			</td>
671
			</tr>
672 7d0ad4ec Joecowboy
			<tr>
673
				<td width="22%" valign="top" class="vncell"><?=gettext("Time format change"); ?></td>
674
				<td width="78%" class="vtable">
675 ee9530e1 Colin Fleming
				<table summary="time format change">
676 7d0ad4ec Joecowboy
					<tr>
677
					<td>
678 ee9530e1 Colin Fleming
						<input name="dhcpv6leaseinlocaltime" type="checkbox" id="dhcpv6leaseinlocaltime" value="yes" <?php if ($pconfig['dhcpv6leaseinlocaltime']) echo "checked=\"checked\""; ?> />
679 7d0ad4ec Joecowboy
					</td>
680
					<td>
681
						<strong>
682
							<?=gettext("Change DHCPv6 display lease time from UTC to local time."); ?>
683
						</strong>
684
					</td>
685
					</tr>
686
					<tr>
687
					<td>&nbsp;</td>
688
					<td>
689
						<span class="red"><strong><?=gettext("Note:");?></strong></span> <?=gettext("By default DHCPv6 leases are displayed in UTC time.  By checking this 
690
						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."); ?>
691
					
692
					</td>
693
					</tr>
694
				</table>
695
				</td>
696
			</tr>
697 99caa67c Seth Mos
			<tr>
698
			<td width="22%" valign="top" class="vncell"><?=gettext("Dynamic DNS");?></td>
699
			<td width="78%" class="vtable">
700
				<div id="showddnsbox">
701 ee9530e1 Colin Fleming
					<input type="button" onclick="show_ddns_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Dynamic DNS");?>
702 99caa67c Seth Mos
				</div>
703
				<div id="showddns" style="display:none">
704 ee9530e1 Colin Fleming
					<input style="vertical-align:middle" type="checkbox" value="yes" name="ddnsupdate" id="ddnsupdate" <?php if($pconfig['ddnsupdate']) echo " checked=\"checked\""; ?> />&nbsp;
705 99caa67c Seth Mos
					<b><?=gettext("Enable registration of DHCP client names in DNS.");?></b><br />
706
					<p>
707 ee9530e1 Colin Fleming
					<input name="ddnsdomain" type="text" class="formfld unknown" id="ddnsdomain" size="28" value="<?=htmlspecialchars($pconfig['ddnsdomain']);?>" /><br />
708 99caa67c Seth Mos
					<?=gettext("Note: Leave blank to disable dynamic DNS registration.");?><br />
709 e51d6e1b Renato Botelho
					<?=gettext("Enter the dynamic DNS domain which will be used to register client names in the DNS server.");?><br />
710 ee9530e1 Colin Fleming
					<input name="ddnsdomainprimary" type="text" class="formfld unknown" id="ddnsdomainprimary" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainprimary']);?>" /><br />
711 87019fc4 Andres Petralli
					<?=gettext("Enter the primary domain name server IP address for the dynamic domain name.");?><br />
712 ee9530e1 Colin Fleming
					<input name="ddnsdomainkeyname" type="text" class="formfld unknown" id="ddnsdomainkeyname" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainkeyname']);?>" /><br />
713 e51d6e1b Renato Botelho
					<?=gettext("Enter the dynamic DNS domain key name which will be used to register client names in the DNS server.");?><br />
714 ee9530e1 Colin Fleming
					<input name="ddnsdomainkey" type="text" class="formfld unknown" id="ddnsdomainkey" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainkey']);?>" /><br />
715 87019fc4 Andres Petralli
					<?=gettext("Enter the dynamic DNS domain key secret which will be used to register client names in the DNS server.");?>
716 ee9530e1 Colin Fleming
					</p>
717 99caa67c Seth Mos
				</div>
718
			</td>
719
			</tr>
720
			<tr>
721
			<td width="22%" valign="top" class="vncell"><?=gettext("NTP servers");?></td>
722
			<td width="78%" class="vtable">
723
				<div id="showntpbox">
724 ee9530e1 Colin Fleming
					<input type="button" onclick="show_ntp_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show NTP configuration");?>
725 99caa67c Seth Mos
				</div>
726
				<div id="showntp" style="display:none">
727 ee9530e1 Colin Fleming
					<input name="ntp1" type="text" class="formfld unknown" id="ntp1" size="28" value="<?=htmlspecialchars($pconfig['ntp1']);?>" /><br />
728
					<input name="ntp2" type="text" class="formfld unknown" id="ntp2" size="28" value="<?=htmlspecialchars($pconfig['ntp2']);?>" />
729 99caa67c Seth Mos
				</div>
730
			</td>
731
			</tr>
732 7d504365 smos
			<!-- ISC dhcpd does not support tftp for ipv6 yet. See redmine #2016
733 99caa67c Seth Mos
			<tr>
734
			<td width="22%" valign="top" class="vncell"><?=gettext("TFTP server");?></td>
735
			<td width="78%" class="vtable">
736
			<div id="showtftpbox">
737 ee9530e1 Colin Fleming
				<input type="button" onclick="show_tftp_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show TFTP configuration");?>
738 99caa67c Seth Mos
			</div>
739
			<div id="showtftp" style="display:none">
740 ee9530e1 Colin Fleming
				<input name="tftp" type="text" class="formfld unknown" id="tftp" size="50" value="<?=htmlspecialchars($pconfig['tftp']);?>" /><br />
741 99caa67c Seth Mos
				<?=gettext("Leave blank to disable.  Enter a full hostname or IP for the TFTP server.");?>
742
			</div>
743
			</td>
744
			</tr>
745 7d504365 smos
			-->
746 99caa67c Seth Mos
			<tr>
747
			<td width="22%" valign="top" class="vncell"><?=gettext("LDAP URI");?></td>
748
			<td width="78%" class="vtable">
749
				<div id="showldapbox">
750 ee9530e1 Colin Fleming
					<input type="button" onclick="show_ldap_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show LDAP configuration");?>
751 99caa67c Seth Mos
				</div>
752
				<div id="showldap" style="display:none">
753 ee9530e1 Colin Fleming
					<input name="ldap" type="text" class="formfld unknown" id="ldap" size="80" value="<?=htmlspecialchars($pconfig['ldap']);?>" /><br />
754 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");?>
755
				</div>
756
			</td>
757
			</tr>
758
			<tr>
759
			<td width="22%" valign="top" class="vncell"><?=gettext("Enable network booting");?></td>
760
			<td width="78%" class="vtable">
761
				<div id="shownetbootbox">
762 ee9530e1 Colin Fleming
					<input type="button" onclick="show_netboot_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Network booting");?>
763 99caa67c Seth Mos
				</div>
764
				<div id="shownetboot" style="display:none">
765 ee9530e1 Colin Fleming
					<input style="vertical-align:middle" type="checkbox" value="yes" name="netboot" id="netboot" <?php if($pconfig['netboot']) echo " checked=\"checked\""; ?> />&nbsp;
766 99caa67c Seth Mos
					<b><?=gettext("Enables network booting.");?></b>
767 1edd5d22 Colin Fleming
					<br/>
768 bd942860 Renato Botelho
					<?=gettext("Enter the Bootfile URL");?>
769 ee9530e1 Colin Fleming
					<input name="bootfile_url" type="text" class="formfld unknown" id="bootfile_url" size="28" value="<?=htmlspecialchars($pconfig['bootfile_url']);?>" />
770 99caa67c Seth Mos
				</div>
771
			</td>
772
			</tr>
773
			<tr>
774
			<td width="22%" valign="top" class="vncell"><?=gettext("Additional BOOTP/DHCP Options");?></td>
775
			<td width="78%" class="vtable">
776
				<div id="shownumbervaluebox">
777 ee9530e1 Colin Fleming
					<input type="button" onclick="show_shownumbervalue()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Additional BOOTP/DHCP Options");?>
778 99caa67c Seth Mos
				</div>
779
				<div id="shownumbervalue" style="display:none">
780 ee9530e1 Colin Fleming
				<table id="maintable" summary="bootp-dhcp options">
781 99caa67c Seth Mos
				<tbody>
782
				<tr>
783
				<td colspan="3">
784
					<div style="padding:5px; margin-top: 16px; margin-bottom: 16px; border:1px dashed #000066; background-color: #ffffff; color: #000000; font-size: 8pt;" id="itemhelp">
785 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>
786 99caa67c Seth Mos
					</div>
787
				</td>
788
				</tr>
789
				<tr>
790
				<td><div id="onecolumn"><?=gettext("Number");?></div></td>
791
				<td><div id="twocolumn"><?=gettext("Value");?></div></td>
792
				</tr>
793
				<?php $counter = 0; ?>
794
				<?php
795
					if($pconfig['numberoptions'])
796
						foreach($pconfig['numberoptions']['item'] as $item):
797
				?>
798
					<?php
799
						$number = $item['number'];
800
						$value = $item['value'];
801
					?>
802
				<tr>
803
				<td>
804
					<input autocomplete="off" name="number<?php echo $counter; ?>" type="text" class="formfld" id="number<?php echo $counter; ?>" size="10" value="<?=htmlspecialchars($number);?>" />
805
				</td>
806
				<td>
807
					<input autocomplete="off" name="value<?php echo $counter; ?>" type="text" class="formfld" id="value<?php echo $counter; ?>" size="55" value="<?=htmlspecialchars($value);?>" />
808
				</td>
809
				<td>
810
					<input type="image" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" onclick="removeRow(this); return false;" value="<?=gettext("Delete");?>" />
811
				</td>
812
				</tr>
813
				<?php $counter++; ?>
814
				<?php endforeach; ?>
815
				</tbody>
816
				</table>
817
				<a onclick="javascript:addRowTo('maintable', 'formfldalias'); return false;" href="#">
818
					<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="<?=gettext("add another entry");?>" />
819
				</a>
820
				<script type="text/javascript">
821 ee9530e1 Colin Fleming
				//<![CDATA[
822 99caa67c Seth Mos
					field_counter_js = 2;
823
					rows = 1;
824
					totalrows = <?php echo $counter; ?>;
825
					loaded = <?php echo $counter; ?>;
826 ee9530e1 Colin Fleming
				//]]>
827 99caa67c Seth Mos
				</script>
828
				</div>
829
830
				</td>
831
			</tr>
832
			<tr>
833
			<td width="22%" valign="top">&nbsp;</td>
834
			<td width="78%">
835 ee9530e1 Colin Fleming
				<input name="if" type="hidden" value="<?=$if;?>" />
836
				<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="enable_change(true)" />
837 99caa67c Seth Mos
			</td>
838
			</tr>
839
			<tr>
840
			<td width="22%" valign="top">&nbsp;</td>
841 8cd558b6 ayvis
			<td width="78%"> <p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br />
842 99caa67c Seth Mos
				</strong></span><?=gettext("The DNS servers entered in"); ?> <a href="system.php"><?=gettext("System: " .
843
				"General setup"); ?></a> <?=gettext("(or the"); ?> <a href="services_dnsmasq.php"><?=gettext("DNS " .
844
				"forwarder"); ?></a>, <?=gettext("if enabled)"); ?> </span><span class="vexpl"><?=gettext("will " .
845 8cd558b6 ayvis
				"be assigned to clients by the DHCP server."); ?><br />
846
				<br />
847 bfb00534 jim-p
				<?=gettext("The DHCP lease table can be viewed on the"); ?> <a href="status_dhcpv6_leases.php"><?=gettext("Status: " .
848 8cd558b6 ayvis
				"DHCPv6 leases"); ?></a> <?=gettext("page."); ?><br />
849 99caa67c Seth Mos
				</span></p>
850
			</td>
851
			</tr>
852
		</table>
853 ee9530e1 Colin Fleming
		<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="static mappings">
854 f2ea45ef jim-p
		<tr>
855
			<td colspan="4" valign="top" class="listtopic"><?=gettext("DHCPv6 Static Mappings for this interface.");?></td>
856
			<td>&nbsp;</td>
857
		</tr>
858 99caa67c Seth Mos
		<tr>
859 2fb056d8 Seth Mos
			<td width="25%" class="listhdrr"><?=gettext("DUID");?></td>
860
			<td width="15%" class="listhdrr"><?=gettext("IPv6 address");?></td>
861 99caa67c Seth Mos
			<td width="20%" class="listhdrr"><?=gettext("Hostname");?></td>
862
			<td width="30%" class="listhdr"><?=gettext("Description");?></td>
863
			<td width="10%" class="list">
864 ee9530e1 Colin Fleming
			<table border="0" cellspacing="0" cellpadding="1" summary="add">
865 99caa67c Seth Mos
			<tr>
866
			<td valign="middle" width="17"></td>
867 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>
868 99caa67c Seth Mos
			</tr>
869
			</table>
870
			</td>
871
		</tr>
872
			<?php if(is_array($a_maps)): ?>
873
			<?php $i = 0; foreach ($a_maps as $mapent): ?>
874 2fb056d8 Seth Mos
			<?php if($mapent['duid'] <> "" or $mapent['ipaddrv6'] <> ""): ?>
875 99caa67c Seth Mos
		<tr>
876 ee9530e1 Colin Fleming
		<td class="listlr" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&amp;id=<?=$i;?>';">
877 2fb056d8 Seth Mos
			<?=htmlspecialchars($mapent['duid']);?>
878 99caa67c Seth Mos
		</td>
879 ee9530e1 Colin Fleming
		<td class="listr" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&amp;id=<?=$i;?>';">
880 4e8e7662 Seth Mos
			<?=htmlspecialchars($mapent['ipaddrv6']);?>&nbsp;
881 99caa67c Seth Mos
		</td>
882 ee9530e1 Colin Fleming
		<td class="listr" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&amp;id=<?=$i;?>';">
883 99caa67c Seth Mos
			<?=htmlspecialchars($mapent['hostname']);?>&nbsp;
884
		</td>
885 ee9530e1 Colin Fleming
		<td class="listbg" ondblclick="document.location='services_dhcpv6_edit.php?if=<?=$if;?>&amp;id=<?=$i;?>';">
886 99caa67c Seth Mos
			<?=htmlspecialchars($mapent['descr']);?>&nbsp;
887
		</td>
888 51bf0dbb Colin Fleming
		<td valign="middle" class="list nowrap">
889 ee9530e1 Colin Fleming
			<table border="0" cellspacing="0" cellpadding="1" summary="icons">
890 99caa67c Seth Mos
			<tr>
891 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>
892
			<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>
893 99caa67c Seth Mos
			</tr>
894
			</table>
895
		</td>
896
		</tr>
897
		<?php endif; ?>
898
		<?php $i++; endforeach; ?>
899
		<?php endif; ?>
900
		<tr>
901
		<td class="list" colspan="4"></td>
902
		<td class="list">
903 ee9530e1 Colin Fleming
			<table border="0" cellspacing="0" cellpadding="1" summary="add">
904 99caa67c Seth Mos
			<tr>
905
			<td valign="middle" width="17"></td>
906 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>
907 99caa67c Seth Mos
			</tr>
908
			</table>
909
		</td>
910
		</tr>
911
		</table>
912
	</div>
913
</td>
914
</tr>
915
</table>
916
</form>
917 91f026b0 ayvis
<script type="text/javascript">
918 ee9530e1 Colin Fleming
//<![CDATA[
919 99caa67c Seth Mos
enable_change(false);
920 ee9530e1 Colin Fleming
//]]>
921 99caa67c Seth Mos
</script>
922
<?php include("fend.inc"); ?>
923
</body>
924
</html>