1
|
<?php
|
2
|
/*
|
3
|
services_dhcpv6.php
|
4
|
*/
|
5
|
/* ====================================================================
|
6
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7
|
* Copyright (c) 2010 Seth Mos <seth.mos@dds.nl>
|
8
|
*
|
9
|
* Some or all of this file is based on the m0n0wall project which is
|
10
|
* Copyright (c) 2004 Manuel Kasper (BSD 2 clause)
|
11
|
*
|
12
|
* Redistribution and use in source and binary forms, with or without modification,
|
13
|
* are permitted provided that the following conditions are met:
|
14
|
*
|
15
|
* 1. Redistributions of source code must retain the above copyright notice,
|
16
|
* this list of conditions and the following disclaimer.
|
17
|
*
|
18
|
* 2. Redistributions in binary form must reproduce the above copyright
|
19
|
* notice, this list of conditions and the following disclaimer in
|
20
|
* the documentation and/or other materials provided with the
|
21
|
* distribution.
|
22
|
*
|
23
|
* 3. All advertising materials mentioning features or use of this software
|
24
|
* must display the following acknowledgment:
|
25
|
* "This product includes software developed by the pfSense Project
|
26
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
27
|
*
|
28
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
29
|
* endorse or promote products derived from this software without
|
30
|
* prior written permission. For written permission, please contact
|
31
|
* coreteam@pfsense.org.
|
32
|
*
|
33
|
* 5. Products derived from this software may not be called "pfSense"
|
34
|
* nor may "pfSense" appear in their names without prior written
|
35
|
* permission of the Electric Sheep Fencing, LLC.
|
36
|
*
|
37
|
* 6. Redistributions of any form whatsoever must retain the following
|
38
|
* acknowledgment:
|
39
|
*
|
40
|
* "This product includes software developed by the pfSense Project
|
41
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
42
|
*
|
43
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
44
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
45
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
46
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
47
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
48
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
49
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
50
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
51
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
52
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
53
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
54
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
55
|
*
|
56
|
* ====================================================================
|
57
|
*
|
58
|
*/
|
59
|
|
60
|
##|+PRIV
|
61
|
##|*IDENT=page-services-dhcpv6server
|
62
|
##|*NAME=Services: DHCPv6 server
|
63
|
##|*DESCR=Allow access to the 'Services: DHCPv6 server' page.
|
64
|
##|*MATCH=services_dhcpv6.php*
|
65
|
##|-PRIV
|
66
|
|
67
|
require("guiconfig.inc");
|
68
|
require_once("filter.inc");
|
69
|
|
70
|
if (!$g['services_dhcp_server_enable']) {
|
71
|
header("Location: /");
|
72
|
exit;
|
73
|
}
|
74
|
|
75
|
/* Fix failover DHCP problem
|
76
|
* http://article.gmane.org/gmane.comp.security.firewalls.pfsense.support/18749
|
77
|
*/
|
78
|
ini_set("memory_limit", "64M");
|
79
|
|
80
|
$if = $_GET['if'];
|
81
|
if ($_POST['if']) {
|
82
|
$if = $_POST['if'];
|
83
|
}
|
84
|
|
85
|
/* if OLSRD is enabled, allow WAN to house DHCP. */
|
86
|
if ($config['installedpackages']['olsrd']) {
|
87
|
foreach ($config['installedpackages']['olsrd']['config'] as $olsrd) {
|
88
|
if ($olsrd['enable']) {
|
89
|
$is_olsr_enabled = true;
|
90
|
break;
|
91
|
}
|
92
|
}
|
93
|
}
|
94
|
|
95
|
$iflist = get_configured_interface_with_descr();
|
96
|
$iflist = array_merge($iflist, get_configured_pppoe_server_interfaces());
|
97
|
|
98
|
/* set the starting interface */
|
99
|
if (!$if || !isset($iflist[$if])) {
|
100
|
foreach ($iflist as $ifent => $ifname) {
|
101
|
$oc = $config['interfaces'][$ifent];
|
102
|
|
103
|
if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
|
104
|
(!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) {
|
105
|
continue;
|
106
|
}
|
107
|
$if = $ifent;
|
108
|
break;
|
109
|
}
|
110
|
}
|
111
|
|
112
|
if (is_array($config['dhcpdv6'][$if])) {
|
113
|
/* DHCPv6 */
|
114
|
if (is_array($config['dhcpdv6'][$if]['range'])) {
|
115
|
$pconfig['range_from'] = $config['dhcpdv6'][$if]['range']['from'];
|
116
|
$pconfig['range_to'] = $config['dhcpdv6'][$if]['range']['to'];
|
117
|
}
|
118
|
if (is_array($config['dhcpdv6'][$if]['prefixrange'])) {
|
119
|
$pconfig['prefixrange_from'] = $config['dhcpdv6'][$if]['prefixrange']['from'];
|
120
|
$pconfig['prefixrange_to'] = $config['dhcpdv6'][$if]['prefixrange']['to'];
|
121
|
$pconfig['prefixrange_length'] = $config['dhcpdv6'][$if]['prefixrange']['prefixlength'];
|
122
|
}
|
123
|
$pconfig['deftime'] = $config['dhcpdv6'][$if]['defaultleasetime'];
|
124
|
$pconfig['maxtime'] = $config['dhcpdv6'][$if]['maxleasetime'];
|
125
|
$pconfig['domain'] = $config['dhcpdv6'][$if]['domain'];
|
126
|
$pconfig['domainsearchlist'] = $config['dhcpdv6'][$if]['domainsearchlist'];
|
127
|
list($pconfig['wins1'], $pconfig['wins2']) = $config['dhcpdv6'][$if]['winsserver'];
|
128
|
list($pconfig['dns1'], $pconfig['dns2'], $pconfig['dns3'], $pconfig['dns4']) = $config['dhcpdv6'][$if]['dnsserver'];
|
129
|
$pconfig['enable'] = isset($config['dhcpdv6'][$if]['enable']);
|
130
|
$pconfig['ddnsdomain'] = $config['dhcpdv6'][$if]['ddnsdomain'];
|
131
|
$pconfig['ddnsdomainprimary'] = $config['dhcpdv6'][$if]['ddnsdomainprimary'];
|
132
|
$pconfig['ddnsdomainkeyname'] = $config['dhcpdv6'][$if]['ddnsdomainkeyname'];
|
133
|
$pconfig['ddnsdomainkey'] = $config['dhcpdv6'][$if]['ddnsdomainkey'];
|
134
|
$pconfig['ddnsupdate'] = isset($config['dhcpdv6'][$if]['ddnsupdate']);
|
135
|
list($pconfig['ntp1'], $pconfig['ntp2']) = $config['dhcpdv6'][$if]['ntpserver'];
|
136
|
$pconfig['tftp'] = $config['dhcpdv6'][$if]['tftp'];
|
137
|
$pconfig['ldap'] = $config['dhcpdv6'][$if]['ldap'];
|
138
|
$pconfig['netboot'] = isset($config['dhcpdv6'][$if]['netboot']);
|
139
|
$pconfig['bootfile_url'] = $config['dhcpdv6'][$if]['bootfile_url'];
|
140
|
$pconfig['netmask'] = $config['dhcpdv6'][$if]['netmask'];
|
141
|
$pconfig['numberoptions'] = $config['dhcpdv6'][$if]['numberoptions'];
|
142
|
$pconfig['dhcpv6leaseinlocaltime'] = $config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'];
|
143
|
if (!is_array($config['dhcpdv6'][$if]['staticmap'])) {
|
144
|
$config['dhcpdv6'][$if]['staticmap'] = array();
|
145
|
}
|
146
|
$a_maps = &$config['dhcpdv6'][$if]['staticmap'];
|
147
|
}
|
148
|
|
149
|
$ifcfgip = get_interface_ipv6($if);
|
150
|
$ifcfgsn = get_interface_subnetv6($if);
|
151
|
|
152
|
/* set the enabled flag which will tell us if DHCP relay is enabled
|
153
|
* on any interface. We will use this to disable DHCP server since
|
154
|
* the two are not compatible with each other.
|
155
|
*/
|
156
|
|
157
|
$dhcrelay_enabled = false;
|
158
|
$dhcrelaycfg = $config['dhcrelay6'];
|
159
|
|
160
|
if (is_array($dhcrelaycfg)) {
|
161
|
foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) {
|
162
|
if (isset($dhcrelayifconf['enable']) && isset($iflist[$dhcrelayif]) &&
|
163
|
(!link_interface_to_bridge($dhcrelayif))) {
|
164
|
$dhcrelay_enabled = true;
|
165
|
}
|
166
|
}
|
167
|
}
|
168
|
|
169
|
if ($_POST) {
|
170
|
unset($input_errors);
|
171
|
|
172
|
$old_dhcpdv6_enable = ($pconfig['enable'] == true);
|
173
|
$new_dhcpdv6_enable = ($_POST['enable'] ? true : false);
|
174
|
$dhcpdv6_enable_changed = ($old_dhcpdv6_enable != $new_dhcpdv6_enable);
|
175
|
|
176
|
$pconfig = $_POST;
|
177
|
|
178
|
$numberoptions = array();
|
179
|
for ($x = 0; $x < 99; $x++) {
|
180
|
if (isset($_POST["number{$x}"]) && ctype_digit($_POST["number{$x}"])) {
|
181
|
$numbervalue = array();
|
182
|
$numbervalue['number'] = htmlspecialchars($_POST["number{$x}"]);
|
183
|
$numbervalue['value'] = base64_encode($_POST["value{$x}"]);
|
184
|
$numberoptions['item'][] = $numbervalue;
|
185
|
}
|
186
|
}
|
187
|
// Reload the new pconfig variable that the forum uses.
|
188
|
$pconfig['numberoptions'] = $numberoptions;
|
189
|
|
190
|
/* input validation */
|
191
|
if ($_POST['enable']) {
|
192
|
$reqdfields = explode(" ", "range_from range_to");
|
193
|
$reqdfieldsn = array(gettext("Range begin"), gettext("Range end"));
|
194
|
|
195
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
|
196
|
|
197
|
if (($_POST['prefixrange_from'] && !is_ipaddrv6($_POST['prefixrange_from']))) {
|
198
|
$input_errors[] = gettext("A valid prefix range must be specified.");
|
199
|
}
|
200
|
if (($_POST['prefixrange_to'] && !is_ipaddrv6($_POST['prefixrange_to']))) {
|
201
|
$input_errors[] = gettext("A valid prefix range must be specified.");
|
202
|
}
|
203
|
if (($_POST['range_from'] && !is_ipaddrv6($_POST['range_from']))) {
|
204
|
$input_errors[] = gettext("A valid range must be specified.");
|
205
|
}
|
206
|
if (($_POST['range_to'] && !is_ipaddrv6($_POST['range_to']))) {
|
207
|
$input_errors[] = gettext("A valid range must be specified.");
|
208
|
}
|
209
|
if (($_POST['gateway'] && !is_ipaddrv6($_POST['gateway']))) {
|
210
|
$input_errors[] = gettext("A valid IPv6 address must be specified for the gateway.");
|
211
|
}
|
212
|
if (($_POST['dns1'] && !is_ipaddrv6($_POST['dns1'])) ||
|
213
|
($_POST['dns2'] && !is_ipaddrv6($_POST['dns2'])) ||
|
214
|
($_POST['dns3'] && !is_ipaddrv6($_POST['dns3'])) ||
|
215
|
($_POST['dns4'] && !is_ipaddrv6($_POST['dns4']))) {
|
216
|
$input_errors[] = gettext("A valid IPv6 address must be specified for each of the DNS servers.");
|
217
|
}
|
218
|
|
219
|
if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60))) {
|
220
|
$input_errors[] = gettext("The default lease time must be at least 60 seconds.");
|
221
|
}
|
222
|
if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime']))) {
|
223
|
$input_errors[] = gettext("The maximum lease time must be at least 60 seconds and higher than the default lease time.");
|
224
|
}
|
225
|
if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain']))) {
|
226
|
$input_errors[] = gettext("A valid domain name must be specified for the dynamic DNS registration.");
|
227
|
}
|
228
|
if (($_POST['ddnsdomain'] && !is_ipaddrv4($_POST['ddnsdomainprimary']))) {
|
229
|
$input_errors[] = gettext("A valid primary domain name server IPv4 address must be specified for the dynamic domain name.");
|
230
|
}
|
231
|
if (($_POST['ddnsdomainkey'] && !$_POST['ddnsdomainkeyname']) ||
|
232
|
($_POST['ddnsdomainkeyname'] && !$_POST['ddnsdomainkey'])) {
|
233
|
$input_errors[] = gettext("You must specify both a valid domain key and key name.");
|
234
|
}
|
235
|
if ($_POST['domainsearchlist']) {
|
236
|
$domain_array=preg_split("/[ ;]+/", $_POST['domainsearchlist']);
|
237
|
foreach ($domain_array as $curdomain) {
|
238
|
if (!is_domain($curdomain)) {
|
239
|
$input_errors[] = gettext("A valid domain search list must be specified.");
|
240
|
break;
|
241
|
}
|
242
|
}
|
243
|
}
|
244
|
|
245
|
if (($_POST['ntp1'] && !is_ipaddrv6($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddrv6($_POST['ntp2']))) {
|
246
|
$input_errors[] = gettext("A valid IPv6 address must be specified for the primary/secondary NTP servers.");
|
247
|
}
|
248
|
if (($_POST['domain'] && !is_domain($_POST['domain']))) {
|
249
|
$input_errors[] = gettext("A valid domain name must be specified for the DNS domain.");
|
250
|
}
|
251
|
if ($_POST['tftp'] && !is_ipaddr($_POST['tftp']) && !is_domain($_POST['tftp']) && !is_URL($_POST['tftp'])) {
|
252
|
$input_errors[] = gettext("A valid IPv6 address or hostname must be specified for the TFTP server.");
|
253
|
}
|
254
|
if (($_POST['bootfile_url'] && !is_URL($_POST['bootfile_url']))) {
|
255
|
$input_errors[] = gettext("A valid URL must be specified for the network bootfile.");
|
256
|
}
|
257
|
|
258
|
// Disallow a range that includes the virtualip
|
259
|
if (is_array($config['virtualip']['vip'])) {
|
260
|
foreach ($config['virtualip']['vip'] as $vip) {
|
261
|
if ($vip['interface'] == $if) {
|
262
|
if ($vip['subnetv6'] && is_inrange_v6($vip['subnetv6'], $_POST['range_from'], $_POST['range_to'])) {
|
263
|
$input_errors[] = sprintf(gettext("The subnet range cannot overlap with virtual IPv6 address %s."), $vip['subnetv6']);
|
264
|
}
|
265
|
}
|
266
|
}
|
267
|
}
|
268
|
|
269
|
$noip = false;
|
270
|
if (is_array($a_maps)) {
|
271
|
foreach ($a_maps as $map) {
|
272
|
if (empty($map['ipaddrv6'])) {
|
273
|
$noip = true;
|
274
|
}
|
275
|
}
|
276
|
}
|
277
|
if (!$input_errors) {
|
278
|
/* make sure the range lies within the current subnet */
|
279
|
$subnet_start = gen_subnetv6($ifcfgip, $ifcfgsn);
|
280
|
$subnet_end = gen_subnetv6_max($ifcfgip, $ifcfgsn);
|
281
|
|
282
|
if (is_ipaddrv6($ifcfgip)) {
|
283
|
if ((!is_inrange_v6($_POST['range_from'], $subnet_start, $subnet_end)) ||
|
284
|
(!is_inrange_v6($_POST['range_to'], $subnet_start, $subnet_end))) {
|
285
|
$input_errors[] = gettext("The specified range lies outside of the current subnet.");
|
286
|
}
|
287
|
}
|
288
|
/* "from" cannot be higher than "to" */
|
289
|
if (inet_pton($_POST['range_from']) > inet_pton($_POST['range_to'])) {
|
290
|
$input_errors[] = gettext("The range is invalid (first element higher than second element).");
|
291
|
}
|
292
|
|
293
|
/* make sure that the DHCP Relay isn't enabled on this interface */
|
294
|
if (isset($config['dhcrelay'][$if]['enable'])) {
|
295
|
$input_errors[] = sprintf(gettext("You must disable the DHCP relay on the %s interface before enabling the DHCP server."), $iflist[$if]);
|
296
|
}
|
297
|
|
298
|
|
299
|
/* Verify static mappings do not overlap:
|
300
|
- available DHCP range
|
301
|
- prefix delegation range (FIXME: still need to be completed) */
|
302
|
$dynsubnet_start = inet_pton($_POST['range_from']);
|
303
|
$dynsubnet_end = inet_pton($_POST['range_to']);
|
304
|
|
305
|
if (is_array($a_maps)) {
|
306
|
foreach ($a_maps as $map) {
|
307
|
if (empty($map['ipaddrv6'])) {
|
308
|
continue;
|
309
|
}
|
310
|
if ((inet_pton($map['ipaddrv6']) > $dynsubnet_start) &&
|
311
|
(inet_pton($map['ipaddrv6']) < $dynsubnet_end)) {
|
312
|
$input_errors[] = sprintf(gettext("The DHCP range cannot overlap any static DHCP mappings."));
|
313
|
break;
|
314
|
}
|
315
|
}
|
316
|
}
|
317
|
}
|
318
|
}
|
319
|
|
320
|
if (!$input_errors) {
|
321
|
if (!is_array($config['dhcpdv6'][$if])) {
|
322
|
$config['dhcpdv6'][$if] = array();
|
323
|
}
|
324
|
if (!is_array($config['dhcpdv6'][$if]['range'])) {
|
325
|
$config['dhcpdv6'][$if]['range'] = array();
|
326
|
}
|
327
|
if (!is_array($config['dhcpdv6'][$if]['prefixrange'])) {
|
328
|
$config['dhcpdv6'][$if]['prefixrange'] = array();
|
329
|
}
|
330
|
|
331
|
$config['dhcpdv6'][$if]['range']['from'] = $_POST['range_from'];
|
332
|
$config['dhcpdv6'][$if]['range']['to'] = $_POST['range_to'];
|
333
|
$config['dhcpdv6'][$if]['prefixrange']['from'] = $_POST['prefixrange_from'];
|
334
|
$config['dhcpdv6'][$if]['prefixrange']['to'] = $_POST['prefixrange_to'];
|
335
|
$config['dhcpdv6'][$if]['prefixrange']['prefixlength'] = $_POST['prefixrange_length'];
|
336
|
$config['dhcpdv6'][$if]['defaultleasetime'] = $_POST['deftime'];
|
337
|
$config['dhcpdv6'][$if]['maxleasetime'] = $_POST['maxtime'];
|
338
|
$config['dhcpdv6'][$if]['netmask'] = $_POST['netmask'];
|
339
|
|
340
|
unset($config['dhcpdv6'][$if]['winsserver']);
|
341
|
|
342
|
unset($config['dhcpdv6'][$if]['dnsserver']);
|
343
|
if ($_POST['dns1']) {
|
344
|
$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns1'];
|
345
|
}
|
346
|
if ($_POST['dns2']) {
|
347
|
$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns2'];
|
348
|
}
|
349
|
if ($_POST['dns3']) {
|
350
|
$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns3'];
|
351
|
}
|
352
|
if ($_POST['dns4']) {
|
353
|
$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns4'];
|
354
|
}
|
355
|
|
356
|
$config['dhcpdv6'][$if]['domain'] = $_POST['domain'];
|
357
|
$config['dhcpdv6'][$if]['domainsearchlist'] = $_POST['domainsearchlist'];
|
358
|
$config['dhcpdv6'][$if]['enable'] = ($_POST['enable']) ? true : false;
|
359
|
$config['dhcpdv6'][$if]['ddnsdomain'] = $_POST['ddnsdomain'];
|
360
|
$config['dhcpdv6'][$if]['ddnsdomainprimary'] = $_POST['ddnsdomainprimary'];
|
361
|
$config['dhcpdv6'][$if]['ddnsdomainkeyname'] = $_POST['ddnsdomainkeyname'];
|
362
|
$config['dhcpdv6'][$if]['ddnsdomainkey'] = $_POST['ddnsdomainkey'];
|
363
|
$config['dhcpdv6'][$if]['ddnsupdate'] = ($_POST['ddnsupdate']) ? true : false;
|
364
|
|
365
|
unset($config['dhcpdv6'][$if]['ntpserver']);
|
366
|
if ($_POST['ntp1']) {
|
367
|
$config['dhcpdv6'][$if]['ntpserver'][] = $_POST['ntp1'];
|
368
|
}
|
369
|
if ($_POST['ntp2']) {
|
370
|
$config['dhcpdv6'][$if]['ntpserver'][] = $_POST['ntp2'];
|
371
|
}
|
372
|
|
373
|
$config['dhcpdv6'][$if]['tftp'] = $_POST['tftp'];
|
374
|
$config['dhcpdv6'][$if]['ldap'] = $_POST['ldap'];
|
375
|
$config['dhcpdv6'][$if]['netboot'] = ($_POST['netboot']) ? true : false;
|
376
|
$config['dhcpdv6'][$if]['bootfile_url'] = $_POST['bootfile_url'];
|
377
|
$config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'] = $_POST['dhcpv6leaseinlocaltime'];
|
378
|
|
379
|
// Handle the custom options rowhelper
|
380
|
if (isset($config['dhcpdv6'][$if]['numberoptions']['item'])) {
|
381
|
unset($config['dhcpdv6'][$if]['numberoptions']['item']);
|
382
|
}
|
383
|
|
384
|
$config['dhcpdv6'][$if]['numberoptions'] = $numberoptions;
|
385
|
|
386
|
write_config();
|
387
|
|
388
|
$retval = 0;
|
389
|
$retvaldhcp = 0;
|
390
|
$retvaldns = 0;
|
391
|
/* Stop DHCPv6 so we can cleanup leases */
|
392
|
killbypid("{$g['dhcpd_chroot_path']}{$g['varrun_path']}/dhcpdv6.pid");
|
393
|
// dhcp_clean_leases();
|
394
|
/* dnsmasq_configure calls dhcpd_configure */
|
395
|
/* no need to restart dhcpd twice */
|
396
|
if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic'])) {
|
397
|
$retvaldns = services_dnsmasq_configure();
|
398
|
if ($retvaldns == 0) {
|
399
|
clear_subsystem_dirty('hosts');
|
400
|
clear_subsystem_dirty('staticmaps');
|
401
|
}
|
402
|
} else if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
|
403
|
$retvaldns = services_unbound_configure();
|
404
|
if ($retvaldns == 0) {
|
405
|
clear_subsystem_dirty('unbound');
|
406
|
clear_subsystem_dirty('staticmaps');
|
407
|
}
|
408
|
} else {
|
409
|
$retvaldhcp = services_dhcpd_configure();
|
410
|
if ($retvaldhcp == 0) {
|
411
|
clear_subsystem_dirty('staticmaps');
|
412
|
}
|
413
|
}
|
414
|
if ($dhcpdv6_enable_changed) {
|
415
|
$retvalfc = filter_configure();
|
416
|
}
|
417
|
if ($retvaldhcp == 1 || $retvaldns == 1 || $retvalfc == 1) {
|
418
|
$retval = 1;
|
419
|
}
|
420
|
$savemsg = get_std_save_message($retval);
|
421
|
}
|
422
|
}
|
423
|
|
424
|
if ($_GET['act'] == "del") {
|
425
|
if ($a_maps[$_GET['id']]) {
|
426
|
unset($a_maps[$_GET['id']]);
|
427
|
write_config();
|
428
|
if (isset($config['dhcpdv6'][$if]['enable'])) {
|
429
|
mark_subsystem_dirty('staticmapsv6');
|
430
|
if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstaticv6'])) {
|
431
|
mark_subsystem_dirty('hosts');
|
432
|
}
|
433
|
}
|
434
|
header("Location: services_dhcpv6.php?if={$if}");
|
435
|
exit;
|
436
|
}
|
437
|
}
|
438
|
|
439
|
$pgtitle = array(gettext("Services"), gettext("DHCPv6 Server"));
|
440
|
$shortcut_section = "dhcp6";
|
441
|
|
442
|
include("head.inc");
|
443
|
|
444
|
if ($input_errors) {
|
445
|
print_input_errors($input_errors);
|
446
|
}
|
447
|
|
448
|
if ($savemsg) {
|
449
|
print_info_box($savemsg, 'success');
|
450
|
}
|
451
|
|
452
|
if ($dhcrelay_enabled) {
|
453
|
print_info_box(gettext("DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface."), 'danger');
|
454
|
include("foot.inc");
|
455
|
exit;
|
456
|
}
|
457
|
|
458
|
if (is_subsystem_dirty('staticmaps')) {
|
459
|
print_apply_box(gettext('The static mapping configuration has been changed.') . '<br />' . gettext('You must apply the changes in order for them to take effect.'));
|
460
|
}
|
461
|
|
462
|
/* active tabs */
|
463
|
$tab_array = array();
|
464
|
$tabscounter = 0;
|
465
|
$i = 0;
|
466
|
|
467
|
foreach ($iflist as $ifent => $ifname) {
|
468
|
$oc = $config['interfaces'][$ifent];
|
469
|
|
470
|
|
471
|
if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
|
472
|
(!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) {
|
473
|
continue;
|
474
|
}
|
475
|
|
476
|
if ($ifent == $if) {
|
477
|
$active = true;
|
478
|
} else {
|
479
|
$active = false;
|
480
|
}
|
481
|
|
482
|
$tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}");
|
483
|
$tabscounter++;
|
484
|
}
|
485
|
|
486
|
/* tack on PPPoE or PPtP servers here */
|
487
|
/* pppoe server */
|
488
|
if (is_array($config['pppoes']['pppoe'])) {
|
489
|
foreach ($config['pppoes']['pppoe'] as $pppoe) {
|
490
|
if ($pppoe['mode'] == "server") {
|
491
|
$ifent = "poes". $pppoe['pppoeid'];
|
492
|
$ifname = strtoupper($ifent);
|
493
|
|
494
|
if ($ifent == $if) {
|
495
|
$active = true;
|
496
|
} else {
|
497
|
$active = false;
|
498
|
}
|
499
|
|
500
|
$tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}");
|
501
|
$tabscounter++;
|
502
|
}
|
503
|
}
|
504
|
}
|
505
|
|
506
|
if ($tabscounter == 0) {
|
507
|
print_info_box(gettext("The DHCPv6 Server can only be enabled on interfaces configured with a static IPv6 address. This system has none."), 'danger');
|
508
|
include("foot.inc");
|
509
|
exit;
|
510
|
}
|
511
|
|
512
|
display_top_tabs($tab_array);
|
513
|
|
514
|
$tab_array = array();
|
515
|
$tab_array[] = array(gettext("DHCPv6 Server"), true, "services_dhcpv6.php?if={$if}");
|
516
|
$tab_array[] = array(gettext("Router Advertisements"), false, "services_router_advertisements.php?if={$if}");
|
517
|
display_top_tabs($tab_array, false, 'nav nav-tabs');
|
518
|
|
519
|
$form = new Form(new Form_Button(
|
520
|
'Submit',
|
521
|
'Save'
|
522
|
));
|
523
|
|
524
|
$section = new Form_Section('DHCPv6 Options');
|
525
|
|
526
|
$section->addInput(new Form_Checkbox(
|
527
|
'enable',
|
528
|
'DHCPv6 Server',
|
529
|
'Enable DHCPv6 server on interface ' . $iflist[$if],
|
530
|
$pconfig['enable']
|
531
|
))->toggles('.form-group:not(:first-child)');
|
532
|
|
533
|
if (is_ipaddrv6($ifcfgip)) {
|
534
|
|
535
|
$section->addInput(new Form_StaticText(
|
536
|
'Subnet',
|
537
|
gen_subnetv6($ifcfgip, $ifcfgsn)
|
538
|
));
|
539
|
|
540
|
$section->addInput(new Form_StaticText(
|
541
|
'Subnet Mask',
|
542
|
$ifcfgsn . ' bits'
|
543
|
));
|
544
|
|
545
|
$section->addInput(new Form_StaticText(
|
546
|
'Available Range',
|
547
|
$range_from = gen_subnetv6($ifcfgip, $ifcfgsn) . ' to ' . gen_subnetv6_max($ifcfgip, $ifcfgsn)
|
548
|
));
|
549
|
}
|
550
|
|
551
|
if ($is_olsr_enabled) {
|
552
|
$section->addInput(new Form_Select(
|
553
|
'netmask',
|
554
|
'Subnet Mask',
|
555
|
$pconfig['netmask'],
|
556
|
array_combine(range(128, 1, -1), range(128, 1, -1))
|
557
|
));
|
558
|
}
|
559
|
|
560
|
$f1 = new Form_Input(
|
561
|
'range_from',
|
562
|
null,
|
563
|
'text',
|
564
|
$pconfig['range_from']
|
565
|
);
|
566
|
|
567
|
$f1->setHelp('To');
|
568
|
|
569
|
$f2 = new Form_Input(
|
570
|
'range_to',
|
571
|
null,
|
572
|
'text',
|
573
|
$pconfig['range_to']
|
574
|
);
|
575
|
|
576
|
$f2->setHelp('From');
|
577
|
|
578
|
$group = new Form_Group('Range');
|
579
|
|
580
|
$group->add($f1);
|
581
|
$group->add($f2);
|
582
|
|
583
|
$section->add($group);
|
584
|
|
585
|
$f1 = new Form_Input(
|
586
|
'prefixrange_from',
|
587
|
null,
|
588
|
'text',
|
589
|
$pconfig['prefixrange_from']
|
590
|
);
|
591
|
|
592
|
$f1->setHelp('To');
|
593
|
|
594
|
$f2 = new Form_Input(
|
595
|
'prefixrange_to',
|
596
|
null,
|
597
|
'text',
|
598
|
$pconfig['prefixrange_to']
|
599
|
);
|
600
|
|
601
|
$f2->setHelp('From');
|
602
|
$group = new Form_Group('Prefix Delegation Range');
|
603
|
|
604
|
$group->add($f1);
|
605
|
$group->add($f2);
|
606
|
|
607
|
$section->add($group);
|
608
|
|
609
|
$section->addInput(new Form_Select(
|
610
|
'prefixrange_length',
|
611
|
'Prefix Delegation Size',
|
612
|
$pconfig['prefixrange_length'],
|
613
|
array(
|
614
|
'48' => '48',
|
615
|
'52' => '52',
|
616
|
'56' => '56',
|
617
|
'60' => '60',
|
618
|
'62' => '62',
|
619
|
'63' => '63',
|
620
|
'64' => '64'
|
621
|
)
|
622
|
))->setHelp('You can define a Prefix range here for DHCP Prefix Delegation. This allows for assigning networks to subrouters. The start and end of the range must end on boundaries of the prefix delegation size.');
|
623
|
|
624
|
$group = new Form_Group('DNS Servers');
|
625
|
|
626
|
for ($i=1;$i<=4; $i++) {
|
627
|
$group->add(new Form_input(
|
628
|
'dns' . $i,
|
629
|
null,
|
630
|
'text',
|
631
|
$pconfig['dns' . $i],
|
632
|
['placeholder' => 'DNS ' . $i]
|
633
|
));
|
634
|
}
|
635
|
|
636
|
$group->setHelp('Leave blank to use the system default DNS servers, this interface\'s IP if DNS forwarder is enabled, or the servers configured on the "General" page.');
|
637
|
$section->add($group);
|
638
|
|
639
|
$section->addInput(new Form_Input(
|
640
|
'domain',
|
641
|
'Domain Name',
|
642
|
'text',
|
643
|
$pconfig['domain']
|
644
|
))->setHelp('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. ');
|
645
|
|
646
|
$section->addInput(new Form_Input(
|
647
|
'domainsearchlist',
|
648
|
'Domain search list',
|
649
|
'text',
|
650
|
$pconfig['domainsearchlist']
|
651
|
))->setHelp('The DHCP server can optionally provide a domain search list. Use the semicolon character as separator');
|
652
|
|
653
|
$section->addInput(new Form_Input(
|
654
|
'deftime',
|
655
|
'Default lease time',
|
656
|
'text',
|
657
|
$pconfig['deftime']
|
658
|
))->setHelp('Seconds . Used for clients that do not ask for a specific expiration time. ' . ' <br />' .
|
659
|
'The default is 7200 seconds.');
|
660
|
|
661
|
$section->addInput(new Form_Input(
|
662
|
'maxtime',
|
663
|
'Max lease time',
|
664
|
'text',
|
665
|
$pconfig['maxtime']
|
666
|
))->setHelp('Maximum lease time for clients that ask for a specific expiration time.' . ' <br />' .
|
667
|
'The default is 86400 seconds.');
|
668
|
|
669
|
$section->addInput(new Form_Checkbox(
|
670
|
'dhcpv6leaseinlocaltime',
|
671
|
'Time Format Change',
|
672
|
'Change DHCPv6 display lease time from UTC to local time',
|
673
|
$pconfig['dhcpv6leaseinlocaltime']
|
674
|
))->setHelp('By default DHCPv6 leases are displayed in UTC time. ' .
|
675
|
'By checking this box DHCPv6 lease time will be displayed in local time and set to time zone selected. ' .
|
676
|
'This will be used for all DHCPv6 interfaces lease time.');
|
677
|
|
678
|
$btndyndns = new Form_Button(
|
679
|
'btndyndns',
|
680
|
'Advanced'
|
681
|
);
|
682
|
|
683
|
$btndyndns->removeClass('btn-primary')->addClass('btn-default btn-sm');
|
684
|
|
685
|
$section->addInput(new Form_StaticText(
|
686
|
'Dynamic DNS',
|
687
|
$btndyndns . ' ' . 'Show dynamic DNS settings'
|
688
|
));
|
689
|
|
690
|
$section->addInput(new Form_Checkbox(
|
691
|
'ddnsupdate',
|
692
|
'DHCP Registration',
|
693
|
'Enable registration of DHCP client names in DNS.',
|
694
|
$pconfig['ddnsupdate']
|
695
|
));
|
696
|
|
697
|
$section->addInput(new Form_Input(
|
698
|
'ddnsdomain',
|
699
|
'DDNS Domain',
|
700
|
'text',
|
701
|
$pconfig['ddnsdomain']
|
702
|
))->setHelp('Leave blank to disable dynamic DNS registration. Enter the dynamic DNS domain which will be used to register client names in the DNS server.');
|
703
|
|
704
|
$section->addInput(new Form_IpAddress(
|
705
|
'ddnsdomainprimary',
|
706
|
'DDNS Server IP',
|
707
|
$pconfig['ddnsdomainprimary']
|
708
|
))->setHelp('Enter the primary domain name server IP address for the dynamic domain name.');
|
709
|
|
710
|
$section->addInput(new Form_Input(
|
711
|
'ddnsdomainkeyname',
|
712
|
'DDNS Domain Key name',
|
713
|
'text',
|
714
|
$pconfig['ddnsdomainkeyname']
|
715
|
))->setHelp('Enter the dynamic DNS domain key name which will be used to register client names in the DNS server.');
|
716
|
|
717
|
$section->addInput(new Form_Input(
|
718
|
'ddnsdomainkey',
|
719
|
'DDNS Domain Key secret',
|
720
|
'text',
|
721
|
$pconfig['ddnsdomainkey']
|
722
|
))->setHelp('Enter the dynamic DNS domain key secret which will be used to register client names in the DNS server.');
|
723
|
|
724
|
$btnntp = new Form_Button(
|
725
|
'btnntp',
|
726
|
'Advanced'
|
727
|
);
|
728
|
|
729
|
$btnntp->removeClass('btn-primary')->addClass('btn-default btn-sm');
|
730
|
|
731
|
$section->addInput(new Form_StaticText(
|
732
|
'NTP servers',
|
733
|
$btnntp . ' ' . 'Show NTP Configuration'
|
734
|
));
|
735
|
|
736
|
$group = new Form_Group('NTP Servers');
|
737
|
|
738
|
$group->add(new Form_Input(
|
739
|
'ntp1',
|
740
|
'NTP Server 1',
|
741
|
'text',
|
742
|
$pconfig['ntp1'],
|
743
|
['placeholder' => 'NTP 1']
|
744
|
));
|
745
|
|
746
|
$group->add(new Form_Input(
|
747
|
'ntp2',
|
748
|
'NTP Server 2',
|
749
|
'text',
|
750
|
$pconfig['ntp2'],
|
751
|
['placeholder' => 'NTP 2']
|
752
|
));
|
753
|
|
754
|
$group->addClass('ntpclass');
|
755
|
|
756
|
$section->add($group);
|
757
|
|
758
|
$btnldap = new Form_Button(
|
759
|
'btnldap',
|
760
|
'Advanced'
|
761
|
);
|
762
|
|
763
|
$btnldap->removeClass('btn-primary')->addClass('btn-default btn-sm');
|
764
|
|
765
|
$section->addInput(new Form_StaticText(
|
766
|
'LDAP',
|
767
|
$btnldap . ' ' . 'Show LDAP Configuration'
|
768
|
));
|
769
|
|
770
|
$section->addInput(new Form_Input(
|
771
|
'ldap',
|
772
|
'LDAP URI',
|
773
|
'text',
|
774
|
$pconfig['ldap']
|
775
|
));
|
776
|
|
777
|
$btnnetboot = new Form_Button(
|
778
|
'btnnetboot',
|
779
|
'Advanced'
|
780
|
);
|
781
|
|
782
|
$btnnetboot->removeClass('btn-primary')->addClass('btn-default btn-sm');
|
783
|
|
784
|
$section->addInput(new Form_StaticText(
|
785
|
'Network booting',
|
786
|
$btnnetboot . ' ' . 'Show Network booting'
|
787
|
));
|
788
|
|
789
|
$section->addInput(new Form_Checkbox(
|
790
|
'shownetboot',
|
791
|
'Network booting',
|
792
|
'Enable Network Booting',
|
793
|
$pconfig['shownetboot']
|
794
|
));
|
795
|
|
796
|
$section->addInput(new Form_Input(
|
797
|
'bootfile_url',
|
798
|
'Bootfile URL',
|
799
|
'text',
|
800
|
$pconfig['bootfile_url']
|
801
|
));
|
802
|
|
803
|
$btnadnl = new Form_Button(
|
804
|
'btnadnl',
|
805
|
'Advanced'
|
806
|
);
|
807
|
|
808
|
$btnadnl->removeClass('btn-primary')->addClass('btn-default btn-sm');
|
809
|
|
810
|
$section->addInput(new Form_StaticText(
|
811
|
'Additional BOOTP/DHCP Options',
|
812
|
$btnadnl . ' ' . 'Additional BOOTP/DHCP Options'
|
813
|
));
|
814
|
|
815
|
$form->add($section);
|
816
|
|
817
|
$title = 'Show Additional BOOTP/DHCP Options';
|
818
|
|
819
|
if (!$pconfig['numberoptions']) {
|
820
|
$noopts = true;
|
821
|
$pconfig['numberoptions']['item'] = array(0 => array('number' => "", 'value' => ""));
|
822
|
} else {
|
823
|
$noopts = false;
|
824
|
}
|
825
|
|
826
|
$counter = 0;
|
827
|
$last = count($pconfig['numberoptions']['item']) - 1;
|
828
|
|
829
|
foreach ($pconfig['numberoptions']['item'] as $item) {
|
830
|
$group = new Form_Group(null);
|
831
|
$group->addClass('repeatable');
|
832
|
$group->addClass('adnloptions');
|
833
|
|
834
|
$group->add(new Form_Input(
|
835
|
'number' . $counter,
|
836
|
null,
|
837
|
'text',
|
838
|
$item['number']
|
839
|
))->setHelp($counter == $last ? 'Number':null);
|
840
|
|
841
|
$group->add(new Form_Input(
|
842
|
'value' . $counter,
|
843
|
null,
|
844
|
'text',
|
845
|
base64_decode($item['value'])
|
846
|
))->setHelp($counter == $last ? 'Value':null);
|
847
|
|
848
|
$btn = new Form_Button(
|
849
|
'deleterow' . $counter,
|
850
|
'Delete'
|
851
|
);
|
852
|
|
853
|
$btn->removeClass('btn-primary')->addClass('btn-warning');
|
854
|
$group->add($btn);
|
855
|
$section->add($group);
|
856
|
$counter++;
|
857
|
}
|
858
|
|
859
|
|
860
|
$btnaddopt = new Form_Button(
|
861
|
'addrowt',
|
862
|
'Add Option'
|
863
|
);
|
864
|
|
865
|
$btnaddopt->removeClass('btn-primary')->addClass('btn-success btn-sm')->addClass('adnloptions');
|
866
|
|
867
|
$section->addInput($btnaddopt);
|
868
|
|
869
|
$section->addInput(new Form_Input(
|
870
|
'if',
|
871
|
null,
|
872
|
'hidden',
|
873
|
$if
|
874
|
));
|
875
|
|
876
|
print($form);
|
877
|
|
878
|
?>
|
879
|
<div class="infoblock blockopen">
|
880
|
<?php
|
881
|
print_info_box(
|
882
|
sprintf(
|
883
|
gettext('The DNS servers entered in %1$sSystem: General setup%3$s (or the %2$sDNS forwarder%3$s if enabled) will be assigned to clients by the DHCP server.'),
|
884
|
'<a href="system.php">',
|
885
|
'<a href="services_dnsmasq.php"/>',
|
886
|
'</a>') .
|
887
|
'<br />' .
|
888
|
sprintf(
|
889
|
gettext('The DHCP lease table can be viewed on the %1$sStatus: DHCPv6 leases%2$s page.'),
|
890
|
'<a href="status_dhcpv6_leases.php">',
|
891
|
'</a>'),
|
892
|
'info',
|
893
|
false);
|
894
|
?>
|
895
|
</div>
|
896
|
<div class="panel panel-default">
|
897
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("DHCPv6 Static Mappings for this interface.");?></h2></div>
|
898
|
<div class="panel-body table-responsive">
|
899
|
<table class="table table-striped table-hover table-condensed">
|
900
|
<thead>
|
901
|
<tr>
|
902
|
<th><?=gettext("DUID")?></th>
|
903
|
<th><?=gettext("IPv6 address")?></th>
|
904
|
<th><?=gettext("Hostname")?></th>
|
905
|
<th><?=gettext("Description")?></th>
|
906
|
<th><!-- Buttons --></th>
|
907
|
</tr>
|
908
|
</thead>
|
909
|
<tbody>
|
910
|
<?php
|
911
|
if (is_array($a_maps)):
|
912
|
$i = 0;
|
913
|
foreach ($a_maps as $mapent):
|
914
|
if ($mapent['duid'] != "" or $mapent['ipaddrv6'] != ""):
|
915
|
?>
|
916
|
<tr>
|
917
|
<td>
|
918
|
<?=htmlspecialchars($mapent['duid'])?>
|
919
|
</td>
|
920
|
<td>
|
921
|
<?=htmlspecialchars($mapent['ipaddrv6'])?>
|
922
|
</td>
|
923
|
<td>
|
924
|
<?=htmlspecialchars($mapent['hostname'])?>
|
925
|
</td>
|
926
|
<td>
|
927
|
<?=htmlspecialchars($mapent['descr'])?>
|
928
|
</td>
|
929
|
<td>
|
930
|
<a class="fa fa-pencil" title="<?=gettext('Edit static mapping')?>" href="services_dhcpv6_edit.php?if=<?=$if?>&id=<?=$i?>"></a>
|
931
|
<a class="fa fa-trash" title="<?=gettext('Delete static mapping')?>" href="services_dhcpv6.php?if=<?=$if?>&act=del&id=<?=$i?>"></a>
|
932
|
</td>
|
933
|
</tr>
|
934
|
<?php
|
935
|
endif;
|
936
|
$i++;
|
937
|
endforeach;
|
938
|
endif;
|
939
|
?>
|
940
|
</tbody>
|
941
|
</table>
|
942
|
</div>
|
943
|
</div>
|
944
|
|
945
|
<nav class="action-buttons">
|
946
|
<a href="services_dhcpv6_edit.php?if=<?=$if?>" class="btn btn-sm btn-success"/>
|
947
|
<i class="fa fa-plus icon-embed-btn"></i>
|
948
|
<?=gettext("Add")?>
|
949
|
</a>
|
950
|
</nav>
|
951
|
|
952
|
<script type="text/javascript">
|
953
|
//<![CDATA[
|
954
|
events.push(function() {
|
955
|
|
956
|
function hideDDNS(hide) {
|
957
|
hideCheckbox('ddnsupdate', hide);
|
958
|
hideInput('ddnsdomain', hide);
|
959
|
hideInput('ddnsdomainprimary', hide);
|
960
|
hideInput('ddnsdomainkeyname', hide);
|
961
|
hideInput('ddnsdomainkey', hide);
|
962
|
}
|
963
|
|
964
|
// Make the 'Copy My MAC' button a plain button, not a submit button
|
965
|
$("#btnmymac").prop('type','button');
|
966
|
|
967
|
// On click, copy the hidden 'mymac' text to the 'mac' input
|
968
|
$("#btnmymac").click(function() {
|
969
|
$('#mac').val('<?=$mymac?>');
|
970
|
});
|
971
|
|
972
|
// Make the 'tftp' button a plain button, not a submit button
|
973
|
$("#btntftp").prop('type','button');
|
974
|
|
975
|
// Show tftp controls
|
976
|
$("#btntftp").click(function() {
|
977
|
hideInput('tftp', false);
|
978
|
});
|
979
|
|
980
|
// Make the 'ntp' button a plain button, not a submit button
|
981
|
$("#btnntp").prop('type','button');
|
982
|
|
983
|
// Show ntp controls
|
984
|
$("#btnntp").click(function() {
|
985
|
hideClass('ntpclass', false);
|
986
|
});
|
987
|
|
988
|
// Make the 'ddns' button a plain button, not a submit button
|
989
|
$("#btndyndns").prop('type','button');
|
990
|
|
991
|
// Show ddns controls
|
992
|
$("#btndyndns").click(function() {
|
993
|
hideDDNS(false);
|
994
|
});
|
995
|
|
996
|
// Make the 'ldap' button a plain button, not a submit button
|
997
|
$("#btnldap").prop('type','button');
|
998
|
|
999
|
// Show ldap controls
|
1000
|
$("#btnldap").click(function() {
|
1001
|
hideInput('ldap', false);
|
1002
|
});
|
1003
|
|
1004
|
// Make the 'netboot' button a plain button, not a submit button
|
1005
|
$("#btnnetboot").prop('type','button');
|
1006
|
|
1007
|
// Show netboot controls
|
1008
|
$("#btnnetboot").click(function() {
|
1009
|
hideInput('bootfile_url', false);
|
1010
|
hideCheckbox('shownetboot', false);
|
1011
|
});
|
1012
|
|
1013
|
// Make the 'additional options' button a plain button, not a submit button
|
1014
|
$("#btnadnl").prop('type','button');
|
1015
|
|
1016
|
// Show additional controls
|
1017
|
$("#btnadnl").click(function() {
|
1018
|
hideClass('adnloptions', false);
|
1019
|
hideInput('btnaddopt', false);
|
1020
|
});
|
1021
|
|
1022
|
// On initial load
|
1023
|
hideDDNS(true);
|
1024
|
hideClass('ntpclass', true);
|
1025
|
hideInput('tftp', true);
|
1026
|
hideInput('ldap', true);
|
1027
|
hideInput('bootfile_url', true);
|
1028
|
hideCheckbox('shownetboot', true);
|
1029
|
hideClass('adnloptions', <?php echo json_encode($noopts); ?>);
|
1030
|
hideInput('btnaddopt', true);
|
1031
|
});
|
1032
|
//]]>
|
1033
|
</script>
|
1034
|
|
1035
|
<?php include('foot.inc');
|