1 |
99caa67c
|
Seth Mos
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
services_dhcpv6.php
|
4 |
|
|
*/
|
5 |
df6cb8fe
|
Stephen Beaver
|
/* ====================================================================
|
6 |
|
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7 |
|
|
* Copyright (c) 2010 Seth Mos <seth.mos@dds.nl>
|
8 |
|
|
*
|
9 |
cb41dd63
|
Renato Botelho
|
* Some or all of this file is based on the m0n0wall project which is
|
10 |
|
|
* Copyright (c) 2004 Manuel Kasper (BSD 2 clause)
|
11 |
191cb31d
|
Stephen Beaver
|
*
|
12 |
df6cb8fe
|
Stephen Beaver
|
* 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 |
99caa67c
|
Seth Mos
|
|
60 |
|
|
##|+PRIV
|
61 |
|
|
##|*IDENT=page-services-dhcpv6server
|
62 |
5230f468
|
jim-p
|
##|*NAME=Services: DHCPv6 server
|
63 |
99caa67c
|
Seth Mos
|
##|*DESCR=Allow access to the 'Services: DHCPv6 server' page.
|
64 |
|
|
##|*MATCH=services_dhcpv6.php*
|
65 |
|
|
##|-PRIV
|
66 |
|
|
|
67 |
|
|
require("guiconfig.inc");
|
68 |
472ad9a0
|
Renato Botelho
|
require_once("filter.inc");
|
69 |
99caa67c
|
Seth Mos
|
|
70 |
8f36f87a
|
jim-p
|
function dhcpv6_apply_changes($dhcpdv6_enable_changed) {
|
71 |
|
|
$retval = 0;
|
72 |
|
|
$retvaldhcp = 0;
|
73 |
|
|
$retvaldns = 0;
|
74 |
|
|
/* Stop DHCPv6 so we can cleanup leases */
|
75 |
|
|
killbypid("{$g['dhcpd_chroot_path']}{$g['varrun_path']}/dhcpdv6.pid");
|
76 |
|
|
// dhcp_clean_leases();
|
77 |
|
|
/* dnsmasq_configure calls dhcpd_configure */
|
78 |
|
|
/* no need to restart dhcpd twice */
|
79 |
|
|
if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic'])) {
|
80 |
|
|
$retvaldns = services_dnsmasq_configure();
|
81 |
|
|
if ($retvaldns == 0) {
|
82 |
|
|
clear_subsystem_dirty('hosts');
|
83 |
|
|
clear_subsystem_dirty('staticmaps');
|
84 |
|
|
}
|
85 |
|
|
} else if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
|
86 |
|
|
$retvaldns = services_unbound_configure();
|
87 |
|
|
if ($retvaldns == 0) {
|
88 |
|
|
clear_subsystem_dirty('unbound');
|
89 |
|
|
clear_subsystem_dirty('staticmaps');
|
90 |
|
|
}
|
91 |
|
|
} else {
|
92 |
|
|
$retvaldhcp = services_dhcpd_configure();
|
93 |
|
|
if ($retvaldhcp == 0) {
|
94 |
|
|
clear_subsystem_dirty('staticmaps');
|
95 |
|
|
}
|
96 |
|
|
}
|
97 |
|
|
if ($dhcpdv6_enable_changed) {
|
98 |
|
|
$retvalfc = filter_configure();
|
99 |
|
|
}
|
100 |
|
|
if ($retvaldhcp == 1 || $retvaldns == 1 || $retvalfc == 1) {
|
101 |
|
|
$retval = 1;
|
102 |
|
|
}
|
103 |
|
|
return get_std_save_message($retval);
|
104 |
|
|
}
|
105 |
|
|
|
106 |
8f8682f7
|
Phil Davis
|
if (!$g['services_dhcp_server_enable']) {
|
107 |
6f3d2063
|
Renato Botelho
|
header("Location: /");
|
108 |
99caa67c
|
Seth Mos
|
exit;
|
109 |
|
|
}
|
110 |
|
|
|
111 |
cd2c7940
|
sbeaver
|
/* Fix failover DHCP problem
|
112 |
|
|
* http://article.gmane.org/gmane.comp.security.firewalls.pfsense.support/18749
|
113 |
99caa67c
|
Seth Mos
|
*/
|
114 |
8f8682f7
|
Phil Davis
|
ini_set("memory_limit", "64M");
|
115 |
99caa67c
|
Seth Mos
|
|
116 |
|
|
$if = $_GET['if'];
|
117 |
8f8682f7
|
Phil Davis
|
if ($_POST['if']) {
|
118 |
99caa67c
|
Seth Mos
|
$if = $_POST['if'];
|
119 |
8f8682f7
|
Phil Davis
|
}
|
120 |
99caa67c
|
Seth Mos
|
|
121 |
|
|
/* if OLSRD is enabled, allow WAN to house DHCP. */
|
122 |
8f8682f7
|
Phil Davis
|
if ($config['installedpackages']['olsrd']) {
|
123 |
|
|
foreach ($config['installedpackages']['olsrd']['config'] as $olsrd) {
|
124 |
|
|
if ($olsrd['enable']) {
|
125 |
cd2c7940
|
sbeaver
|
$is_olsr_enabled = true;
|
126 |
|
|
break;
|
127 |
|
|
}
|
128 |
99caa67c
|
Seth Mos
|
}
|
129 |
|
|
}
|
130 |
|
|
|
131 |
|
|
$iflist = get_configured_interface_with_descr();
|
132 |
16d9ad13
|
smos
|
$iflist = array_merge($iflist, get_configured_pppoe_server_interfaces());
|
133 |
99caa67c
|
Seth Mos
|
|
134 |
|
|
/* set the starting interface */
|
135 |
|
|
if (!$if || !isset($iflist[$if])) {
|
136 |
|
|
foreach ($iflist as $ifent => $ifname) {
|
137 |
|
|
$oc = $config['interfaces'][$ifent];
|
138 |
2bf455ca
|
Renato Botelho
|
$valid_if_ipaddrv6 = (bool) ($oc['ipaddrv6'] == 'track6' ||
|
139 |
|
|
(is_ipaddrv6($oc['ipaddrv6']) &&
|
140 |
|
|
!is_linklocal($oc['ipaddrv6'])));
|
141 |
c80e6a6a
|
Stephen Beaver
|
|
142 |
48602774
|
Renato Botelho
|
if ((!is_array($config['dhcpdv6'][$ifent]) ||
|
143 |
|
|
!isset($config['dhcpdv6'][$ifent]['enable'])) &&
|
144 |
|
|
!$valid_if_ipaddrv6) {
|
145 |
99caa67c
|
Seth Mos
|
continue;
|
146 |
8f8682f7
|
Phil Davis
|
}
|
147 |
99caa67c
|
Seth Mos
|
$if = $ifent;
|
148 |
|
|
break;
|
149 |
|
|
}
|
150 |
|
|
}
|
151 |
|
|
|
152 |
8f8682f7
|
Phil Davis
|
if (is_array($config['dhcpdv6'][$if])) {
|
153 |
fe838158
|
smos
|
/* DHCPv6 */
|
154 |
99caa67c
|
Seth Mos
|
if (is_array($config['dhcpdv6'][$if]['range'])) {
|
155 |
|
|
$pconfig['range_from'] = $config['dhcpdv6'][$if]['range']['from'];
|
156 |
|
|
$pconfig['range_to'] = $config['dhcpdv6'][$if]['range']['to'];
|
157 |
|
|
}
|
158 |
bfb3e717
|
Seth Mos
|
if (is_array($config['dhcpdv6'][$if]['prefixrange'])) {
|
159 |
|
|
$pconfig['prefixrange_from'] = $config['dhcpdv6'][$if]['prefixrange']['from'];
|
160 |
|
|
$pconfig['prefixrange_to'] = $config['dhcpdv6'][$if]['prefixrange']['to'];
|
161 |
|
|
$pconfig['prefixrange_length'] = $config['dhcpdv6'][$if]['prefixrange']['prefixlength'];
|
162 |
|
|
}
|
163 |
99caa67c
|
Seth Mos
|
$pconfig['deftime'] = $config['dhcpdv6'][$if]['defaultleasetime'];
|
164 |
|
|
$pconfig['maxtime'] = $config['dhcpdv6'][$if]['maxleasetime'];
|
165 |
|
|
$pconfig['domain'] = $config['dhcpdv6'][$if]['domain'];
|
166 |
|
|
$pconfig['domainsearchlist'] = $config['dhcpdv6'][$if]['domainsearchlist'];
|
167 |
8f8682f7
|
Phil Davis
|
list($pconfig['wins1'], $pconfig['wins2']) = $config['dhcpdv6'][$if]['winsserver'];
|
168 |
|
|
list($pconfig['dns1'], $pconfig['dns2'], $pconfig['dns3'], $pconfig['dns4']) = $config['dhcpdv6'][$if]['dnsserver'];
|
169 |
99caa67c
|
Seth Mos
|
$pconfig['enable'] = isset($config['dhcpdv6'][$if]['enable']);
|
170 |
|
|
$pconfig['ddnsdomain'] = $config['dhcpdv6'][$if]['ddnsdomain'];
|
171 |
87019fc4
|
Andres Petralli
|
$pconfig['ddnsdomainprimary'] = $config['dhcpdv6'][$if]['ddnsdomainprimary'];
|
172 |
|
|
$pconfig['ddnsdomainkeyname'] = $config['dhcpdv6'][$if]['ddnsdomainkeyname'];
|
173 |
|
|
$pconfig['ddnsdomainkey'] = $config['dhcpdv6'][$if]['ddnsdomainkey'];
|
174 |
99caa67c
|
Seth Mos
|
$pconfig['ddnsupdate'] = isset($config['dhcpdv6'][$if]['ddnsupdate']);
|
175 |
391d63da
|
Renato Botelho
|
$pconfig['ddnsreverse'] = isset($config['dhcpdv6'][$if]['ddnsreverse']);
|
176 |
|
|
$pconfig['ddnsclientupdates'] = $config['dhcpdv6'][$if]['ddnsclientupdates'];
|
177 |
8f8682f7
|
Phil Davis
|
list($pconfig['ntp1'], $pconfig['ntp2']) = $config['dhcpdv6'][$if]['ntpserver'];
|
178 |
99caa67c
|
Seth Mos
|
$pconfig['tftp'] = $config['dhcpdv6'][$if]['tftp'];
|
179 |
|
|
$pconfig['ldap'] = $config['dhcpdv6'][$if]['ldap'];
|
180 |
|
|
$pconfig['netboot'] = isset($config['dhcpdv6'][$if]['netboot']);
|
181 |
bd942860
|
Renato Botelho
|
$pconfig['bootfile_url'] = $config['dhcpdv6'][$if]['bootfile_url'];
|
182 |
99caa67c
|
Seth Mos
|
$pconfig['netmask'] = $config['dhcpdv6'][$if]['netmask'];
|
183 |
|
|
$pconfig['numberoptions'] = $config['dhcpdv6'][$if]['numberoptions'];
|
184 |
138208bf
|
Joecowboy
|
$pconfig['dhcpv6leaseinlocaltime'] = $config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'];
|
185 |
8f8682f7
|
Phil Davis
|
if (!is_array($config['dhcpdv6'][$if]['staticmap'])) {
|
186 |
99caa67c
|
Seth Mos
|
$config['dhcpdv6'][$if]['staticmap'] = array();
|
187 |
8f8682f7
|
Phil Davis
|
}
|
188 |
99caa67c
|
Seth Mos
|
$a_maps = &$config['dhcpdv6'][$if]['staticmap'];
|
189 |
|
|
}
|
190 |
|
|
|
191 |
2bf455ca
|
Renato Botelho
|
if ($config['interfaces'][$if]['ipaddrv6'] == 'track6') {
|
192 |
6c8beed3
|
Renato Botelho
|
$trackifname = $config['interfaces'][$if]['track6-interface'];
|
193 |
|
|
$trackcfg = $config['interfaces'][$trackifname];
|
194 |
a5776226
|
Chris Buechler
|
$ifcfgsn = "64";
|
195 |
2bf455ca
|
Renato Botelho
|
$ifcfgip = '::';
|
196 |
6c8beed3
|
Renato Botelho
|
|
197 |
|
|
$str_help_mask = dhcpv6_pd_str_help($ifcfgsn);
|
198 |
2bf455ca
|
Renato Botelho
|
} else {
|
199 |
|
|
$ifcfgip = get_interface_ipv6($if);
|
200 |
|
|
$ifcfgsn = get_interface_subnetv6($if);
|
201 |
|
|
}
|
202 |
99caa67c
|
Seth Mos
|
|
203 |
cd2c7940
|
sbeaver
|
/* set the enabled flag which will tell us if DHCP relay is enabled
|
204 |
|
|
* on any interface. We will use this to disable DHCP server since
|
205 |
|
|
* the two are not compatible with each other.
|
206 |
99caa67c
|
Seth Mos
|
*/
|
207 |
|
|
|
208 |
|
|
$dhcrelay_enabled = false;
|
209 |
80c88a68
|
smos
|
$dhcrelaycfg = $config['dhcrelay6'];
|
210 |
99caa67c
|
Seth Mos
|
|
211 |
9c06758b
|
k-paulius
|
if (is_array($dhcrelaycfg) && isset($dhcrelaycfg['enable']) && isset($dhcrelaycfg['interface']) && !empty($dhcrelaycfg['interface'])) {
|
212 |
|
|
$dhcrelayifs = explode(",", $dhcrelaycfg['interface']);
|
213 |
|
|
|
214 |
|
|
foreach ($dhcrelayifs as $dhcrelayif) {
|
215 |
|
|
|
216 |
|
|
if (isset($iflist[$dhcrelayif]) && (!link_interface_to_bridge($dhcrelayif))) {
|
217 |
99caa67c
|
Seth Mos
|
$dhcrelay_enabled = true;
|
218 |
9c06758b
|
k-paulius
|
break;
|
219 |
8f8682f7
|
Phil Davis
|
}
|
220 |
99caa67c
|
Seth Mos
|
}
|
221 |
|
|
}
|
222 |
|
|
|
223 |
8f36f87a
|
jim-p
|
if ($_POST['apply'] == "Apply Changes") {
|
224 |
|
|
$savemsg = dhcpv6_apply_changes(false);
|
225 |
|
|
} elseif ($_POST['Submit'] == "Save") {
|
226 |
99caa67c
|
Seth Mos
|
unset($input_errors);
|
227 |
|
|
|
228 |
472ad9a0
|
Renato Botelho
|
$old_dhcpdv6_enable = ($pconfig['enable'] == true);
|
229 |
|
|
$new_dhcpdv6_enable = ($_POST['enable'] ? true : false);
|
230 |
|
|
$dhcpdv6_enable_changed = ($old_dhcpdv6_enable != $new_dhcpdv6_enable);
|
231 |
|
|
|
232 |
99caa67c
|
Seth Mos
|
$pconfig = $_POST;
|
233 |
|
|
|
234 |
|
|
$numberoptions = array();
|
235 |
6c07db48
|
Phil Davis
|
for ($x = 0; $x < 99; $x++) {
|
236 |
8f8682f7
|
Phil Davis
|
if (isset($_POST["number{$x}"]) && ctype_digit($_POST["number{$x}"])) {
|
237 |
99caa67c
|
Seth Mos
|
$numbervalue = array();
|
238 |
|
|
$numbervalue['number'] = htmlspecialchars($_POST["number{$x}"]);
|
239 |
65cce9d7
|
Renato Botelho
|
$numbervalue['value'] = base64_encode($_POST["value{$x}"]);
|
240 |
99caa67c
|
Seth Mos
|
$numberoptions['item'][] = $numbervalue;
|
241 |
|
|
}
|
242 |
|
|
}
|
243 |
|
|
// Reload the new pconfig variable that the forum uses.
|
244 |
|
|
$pconfig['numberoptions'] = $numberoptions;
|
245 |
|
|
|
246 |
|
|
/* input validation */
|
247 |
|
|
if ($_POST['enable']) {
|
248 |
|
|
$reqdfields = explode(" ", "range_from range_to");
|
249 |
8f8682f7
|
Phil Davis
|
$reqdfieldsn = array(gettext("Range begin"), gettext("Range end"));
|
250 |
99caa67c
|
Seth Mos
|
|
251 |
1e9b4611
|
Renato Botelho
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
|
252 |
99caa67c
|
Seth Mos
|
|
253 |
8f8682f7
|
Phil Davis
|
if (($_POST['prefixrange_from'] && !is_ipaddrv6($_POST['prefixrange_from']))) {
|
254 |
0a8a90f7
|
Phil Davis
|
$input_errors[] = gettext("A valid prefix range must be specified.");
|
255 |
8f8682f7
|
Phil Davis
|
}
|
256 |
|
|
if (($_POST['prefixrange_to'] && !is_ipaddrv6($_POST['prefixrange_to']))) {
|
257 |
bfb3e717
|
Seth Mos
|
$input_errors[] = gettext("A valid prefix range must be specified.");
|
258 |
8f8682f7
|
Phil Davis
|
}
|
259 |
bcc2b417
|
Renato Botelho
|
|
260 |
|
|
if ($_POST['prefixrange_from'] && $_POST['prefixrange_to'] &&
|
261 |
|
|
$_POST['prefixrange_length']) {
|
262 |
|
|
$netmask = Net_IPv6::getNetmask($_POST['prefixrange_from'],
|
263 |
|
|
$_POST['prefixrange_length']);
|
264 |
|
|
$netmask = Net_IPv6::compress($netmask);
|
265 |
|
|
|
266 |
7ef4b39d
|
Renato Botelho
|
if ($netmask != Net_IPv6::compress(strtolower(
|
267 |
|
|
$_POST['prefixrange_from']))) {
|
268 |
bcc2b417
|
Renato Botelho
|
$input_errors[] = sprintf(gettext(
|
269 |
|
|
"Prefix Delegation From address is not a valid IPv6 Netmask for %s"),
|
270 |
|
|
$netmask . '/' . $_POST['prefixrange_length']);
|
271 |
|
|
}
|
272 |
|
|
|
273 |
|
|
$netmask = Net_IPv6::getNetmask($_POST['prefixrange_to'],
|
274 |
|
|
$_POST['prefixrange_length']);
|
275 |
|
|
$netmask = Net_IPv6::compress($netmask);
|
276 |
|
|
|
277 |
7ef4b39d
|
Renato Botelho
|
if ($netmask != Net_IPv6::compress(strtolower(
|
278 |
|
|
$_POST['prefixrange_to']))) {
|
279 |
bcc2b417
|
Renato Botelho
|
$input_errors[] = sprintf(gettext(
|
280 |
|
|
"Prefix Delegation To address is not a valid IPv6 Netmask for %s"),
|
281 |
|
|
$netmask . '/' . $_POST['prefixrange_length']);
|
282 |
|
|
}
|
283 |
|
|
}
|
284 |
|
|
|
285 |
2bf455ca
|
Renato Botelho
|
if ($_POST['range_from']) {
|
286 |
|
|
if (!is_ipaddrv6($_POST['range_from'])) {
|
287 |
|
|
$input_errors[] = gettext("A valid range must be specified.");
|
288 |
|
|
} elseif ($config['interfaces'][$if]['ipaddrv6'] == 'track6' &&
|
289 |
6c8beed3
|
Renato Botelho
|
!Net_IPv6::isInNetmask($_POST['range_from'], '::', $ifcfgsn)) {
|
290 |
|
|
$input_errors[] = sprintf(gettext(
|
291 |
|
|
"The prefix (upper %s bits) must be zero. Use the form %s"),
|
292 |
|
|
$ifcfgsn, $str_help_mask);
|
293 |
2bf455ca
|
Renato Botelho
|
}
|
294 |
8f8682f7
|
Phil Davis
|
}
|
295 |
2bf455ca
|
Renato Botelho
|
if ($_POST['range_to']) {
|
296 |
|
|
if (!is_ipaddrv6($_POST['range_to'])) {
|
297 |
|
|
$input_errors[] = gettext("A valid range must be specified.");
|
298 |
|
|
} elseif ($config['interfaces'][$if]['ipaddrv6'] == 'track6' &&
|
299 |
6c8beed3
|
Renato Botelho
|
!Net_IPv6::isInNetmask($_POST['range_to'], '::', $ifcfgsn)) {
|
300 |
|
|
$input_errors[] = sprintf(gettext(
|
301 |
|
|
"The prefix (upper %s bits) must be zero. Use the form %s"),
|
302 |
|
|
$ifcfgsn, $str_help_mask);
|
303 |
2bf455ca
|
Renato Botelho
|
}
|
304 |
8f8682f7
|
Phil Davis
|
}
|
305 |
|
|
if (($_POST['gateway'] && !is_ipaddrv6($_POST['gateway']))) {
|
306 |
99caa67c
|
Seth Mos
|
$input_errors[] = gettext("A valid IPv6 address must be specified for the gateway.");
|
307 |
8f8682f7
|
Phil Davis
|
}
|
308 |
|
|
if (($_POST['dns1'] && !is_ipaddrv6($_POST['dns1'])) ||
|
309 |
6e3488e9
|
Phil Davis
|
($_POST['dns2'] && !is_ipaddrv6($_POST['dns2'])) ||
|
310 |
|
|
($_POST['dns3'] && !is_ipaddrv6($_POST['dns3'])) ||
|
311 |
|
|
($_POST['dns4'] && !is_ipaddrv6($_POST['dns4']))) {
|
312 |
3d88ea11
|
Phil Davis
|
$input_errors[] = gettext("A valid IPv6 address must be specified for each of the DNS servers.");
|
313 |
8f8682f7
|
Phil Davis
|
}
|
314 |
99caa67c
|
Seth Mos
|
|
315 |
8f8682f7
|
Phil Davis
|
if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60))) {
|
316 |
99caa67c
|
Seth Mos
|
$input_errors[] = gettext("The default lease time must be at least 60 seconds.");
|
317 |
8f8682f7
|
Phil Davis
|
}
|
318 |
|
|
if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime']))) {
|
319 |
99caa67c
|
Seth Mos
|
$input_errors[] = gettext("The maximum lease time must be at least 60 seconds and higher than the default lease time.");
|
320 |
8f8682f7
|
Phil Davis
|
}
|
321 |
|
|
if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain']))) {
|
322 |
99caa67c
|
Seth Mos
|
$input_errors[] = gettext("A valid domain name must be specified for the dynamic DNS registration.");
|
323 |
8f8682f7
|
Phil Davis
|
}
|
324 |
|
|
if (($_POST['ddnsdomain'] && !is_ipaddrv4($_POST['ddnsdomainprimary']))) {
|
325 |
87019fc4
|
Andres Petralli
|
$input_errors[] = gettext("A valid primary domain name server IPv4 address must be specified for the dynamic domain name.");
|
326 |
8f8682f7
|
Phil Davis
|
}
|
327 |
87019fc4
|
Andres Petralli
|
if (($_POST['ddnsdomainkey'] && !$_POST['ddnsdomainkeyname']) ||
|
328 |
6e3488e9
|
Phil Davis
|
($_POST['ddnsdomainkeyname'] && !$_POST['ddnsdomainkey'])) {
|
329 |
87019fc4
|
Andres Petralli
|
$input_errors[] = gettext("You must specify both a valid domain key and key name.");
|
330 |
8f8682f7
|
Phil Davis
|
}
|
331 |
a3de8b9e
|
Pierre POMES
|
if ($_POST['domainsearchlist']) {
|
332 |
8f8682f7
|
Phil Davis
|
$domain_array=preg_split("/[ ;]+/", $_POST['domainsearchlist']);
|
333 |
a3de8b9e
|
Pierre POMES
|
foreach ($domain_array as $curdomain) {
|
334 |
|
|
if (!is_domain($curdomain)) {
|
335 |
|
|
$input_errors[] = gettext("A valid domain search list must be specified.");
|
336 |
|
|
break;
|
337 |
|
|
}
|
338 |
|
|
}
|
339 |
|
|
}
|
340 |
|
|
|
341 |
8f8682f7
|
Phil Davis
|
if (($_POST['ntp1'] && !is_ipaddrv6($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddrv6($_POST['ntp2']))) {
|
342 |
99caa67c
|
Seth Mos
|
$input_errors[] = gettext("A valid IPv6 address must be specified for the primary/secondary NTP servers.");
|
343 |
8f8682f7
|
Phil Davis
|
}
|
344 |
|
|
if (($_POST['domain'] && !is_domain($_POST['domain']))) {
|
345 |
99caa67c
|
Seth Mos
|
$input_errors[] = gettext("A valid domain name must be specified for the DNS domain.");
|
346 |
8f8682f7
|
Phil Davis
|
}
|
347 |
|
|
if ($_POST['tftp'] && !is_ipaddr($_POST['tftp']) && !is_domain($_POST['tftp']) && !is_URL($_POST['tftp'])) {
|
348 |
99caa67c
|
Seth Mos
|
$input_errors[] = gettext("A valid IPv6 address or hostname must be specified for the TFTP server.");
|
349 |
8f8682f7
|
Phil Davis
|
}
|
350 |
|
|
if (($_POST['bootfile_url'] && !is_URL($_POST['bootfile_url']))) {
|
351 |
bd942860
|
Renato Botelho
|
$input_errors[] = gettext("A valid URL must be specified for the network bootfile.");
|
352 |
8f8682f7
|
Phil Davis
|
}
|
353 |
99caa67c
|
Seth Mos
|
|
354 |
|
|
// Disallow a range that includes the virtualip
|
355 |
|
|
if (is_array($config['virtualip']['vip'])) {
|
356 |
8f8682f7
|
Phil Davis
|
foreach ($config['virtualip']['vip'] as $vip) {
|
357 |
|
|
if ($vip['interface'] == $if) {
|
358 |
|
|
if ($vip['subnetv6'] && is_inrange_v6($vip['subnetv6'], $_POST['range_from'], $_POST['range_to'])) {
|
359 |
|
|
$input_errors[] = sprintf(gettext("The subnet range cannot overlap with virtual IPv6 address %s."), $vip['subnetv6']);
|
360 |
|
|
}
|
361 |
|
|
}
|
362 |
99caa67c
|
Seth Mos
|
}
|
363 |
|
|
}
|
364 |
|
|
|
365 |
|
|
$noip = false;
|
366 |
8f8682f7
|
Phil Davis
|
if (is_array($a_maps)) {
|
367 |
cd2c7940
|
sbeaver
|
foreach ($a_maps as $map) {
|
368 |
8f8682f7
|
Phil Davis
|
if (empty($map['ipaddrv6'])) {
|
369 |
99caa67c
|
Seth Mos
|
$noip = true;
|
370 |
8f8682f7
|
Phil Davis
|
}
|
371 |
cd2c7940
|
sbeaver
|
}
|
372 |
|
|
}
|
373 |
99caa67c
|
Seth Mos
|
if (!$input_errors) {
|
374 |
|
|
/* make sure the range lies within the current subnet */
|
375 |
|
|
$subnet_start = gen_subnetv6($ifcfgip, $ifcfgsn);
|
376 |
|
|
$subnet_end = gen_subnetv6_max($ifcfgip, $ifcfgsn);
|
377 |
|
|
|
378 |
16d9ad13
|
smos
|
if (is_ipaddrv6($ifcfgip)) {
|
379 |
8f8682f7
|
Phil Davis
|
if ((!is_inrange_v6($_POST['range_from'], $subnet_start, $subnet_end)) ||
|
380 |
6e3488e9
|
Phil Davis
|
(!is_inrange_v6($_POST['range_to'], $subnet_start, $subnet_end))) {
|
381 |
16d9ad13
|
smos
|
$input_errors[] = gettext("The specified range lies outside of the current subnet.");
|
382 |
|
|
}
|
383 |
99caa67c
|
Seth Mos
|
}
|
384 |
731de711
|
Pierre POMES
|
/* "from" cannot be higher than "to" */
|
385 |
8f8682f7
|
Phil Davis
|
if (inet_pton($_POST['range_from']) > inet_pton($_POST['range_to'])) {
|
386 |
99caa67c
|
Seth Mos
|
$input_errors[] = gettext("The range is invalid (first element higher than second element).");
|
387 |
8f8682f7
|
Phil Davis
|
}
|
388 |
99caa67c
|
Seth Mos
|
|
389 |
|
|
/* make sure that the DHCP Relay isn't enabled on this interface */
|
390 |
8f8682f7
|
Phil Davis
|
if (isset($config['dhcrelay'][$if]['enable'])) {
|
391 |
|
|
$input_errors[] = sprintf(gettext("You must disable the DHCP relay on the %s interface before enabling the DHCP server."), $iflist[$if]);
|
392 |
|
|
}
|
393 |
99caa67c
|
Seth Mos
|
|
394 |
731de711
|
Pierre POMES
|
|
395 |
|
|
/* Verify static mappings do not overlap:
|
396 |
|
|
- available DHCP range
|
397 |
|
|
- prefix delegation range (FIXME: still need to be completed) */
|
398 |
|
|
$dynsubnet_start = inet_pton($_POST['range_from']);
|
399 |
|
|
$dynsubnet_end = inet_pton($_POST['range_to']);
|
400 |
|
|
|
401 |
8f8682f7
|
Phil Davis
|
if (is_array($a_maps)) {
|
402 |
99caa67c
|
Seth Mos
|
foreach ($a_maps as $map) {
|
403 |
8f8682f7
|
Phil Davis
|
if (empty($map['ipaddrv6'])) {
|
404 |
99caa67c
|
Seth Mos
|
continue;
|
405 |
8f8682f7
|
Phil Davis
|
}
|
406 |
731de711
|
Pierre POMES
|
if ((inet_pton($map['ipaddrv6']) > $dynsubnet_start) &&
|
407 |
6e3488e9
|
Phil Davis
|
(inet_pton($map['ipaddrv6']) < $dynsubnet_end)) {
|
408 |
99caa67c
|
Seth Mos
|
$input_errors[] = sprintf(gettext("The DHCP range cannot overlap any static DHCP mappings."));
|
409 |
|
|
break;
|
410 |
|
|
}
|
411 |
|
|
}
|
412 |
|
|
}
|
413 |
|
|
}
|
414 |
|
|
}
|
415 |
|
|
|
416 |
|
|
if (!$input_errors) {
|
417 |
8f8682f7
|
Phil Davis
|
if (!is_array($config['dhcpdv6'][$if])) {
|
418 |
99caa67c
|
Seth Mos
|
$config['dhcpdv6'][$if] = array();
|
419 |
8f8682f7
|
Phil Davis
|
}
|
420 |
|
|
if (!is_array($config['dhcpdv6'][$if]['range'])) {
|
421 |
99caa67c
|
Seth Mos
|
$config['dhcpdv6'][$if]['range'] = array();
|
422 |
8f8682f7
|
Phil Davis
|
}
|
423 |
|
|
if (!is_array($config['dhcpdv6'][$if]['prefixrange'])) {
|
424 |
bfb3e717
|
Seth Mos
|
$config['dhcpdv6'][$if]['prefixrange'] = array();
|
425 |
8f8682f7
|
Phil Davis
|
}
|
426 |
99caa67c
|
Seth Mos
|
|
427 |
|
|
$config['dhcpdv6'][$if]['range']['from'] = $_POST['range_from'];
|
428 |
|
|
$config['dhcpdv6'][$if]['range']['to'] = $_POST['range_to'];
|
429 |
bfb3e717
|
Seth Mos
|
$config['dhcpdv6'][$if]['prefixrange']['from'] = $_POST['prefixrange_from'];
|
430 |
|
|
$config['dhcpdv6'][$if]['prefixrange']['to'] = $_POST['prefixrange_to'];
|
431 |
|
|
$config['dhcpdv6'][$if]['prefixrange']['prefixlength'] = $_POST['prefixrange_length'];
|
432 |
99caa67c
|
Seth Mos
|
$config['dhcpdv6'][$if]['defaultleasetime'] = $_POST['deftime'];
|
433 |
|
|
$config['dhcpdv6'][$if]['maxleasetime'] = $_POST['maxtime'];
|
434 |
|
|
$config['dhcpdv6'][$if]['netmask'] = $_POST['netmask'];
|
435 |
|
|
|
436 |
|
|
unset($config['dhcpdv6'][$if]['winsserver']);
|
437 |
|
|
|
438 |
|
|
unset($config['dhcpdv6'][$if]['dnsserver']);
|
439 |
8f8682f7
|
Phil Davis
|
if ($_POST['dns1']) {
|
440 |
99caa67c
|
Seth Mos
|
$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns1'];
|
441 |
8f8682f7
|
Phil Davis
|
}
|
442 |
|
|
if ($_POST['dns2']) {
|
443 |
99caa67c
|
Seth Mos
|
$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns2'];
|
444 |
8f8682f7
|
Phil Davis
|
}
|
445 |
|
|
if ($_POST['dns3']) {
|
446 |
3d88ea11
|
Phil Davis
|
$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns3'];
|
447 |
8f8682f7
|
Phil Davis
|
}
|
448 |
|
|
if ($_POST['dns4']) {
|
449 |
3d88ea11
|
Phil Davis
|
$config['dhcpdv6'][$if]['dnsserver'][] = $_POST['dns4'];
|
450 |
8f8682f7
|
Phil Davis
|
}
|
451 |
99caa67c
|
Seth Mos
|
|
452 |
|
|
$config['dhcpdv6'][$if]['domain'] = $_POST['domain'];
|
453 |
|
|
$config['dhcpdv6'][$if]['domainsearchlist'] = $_POST['domainsearchlist'];
|
454 |
|
|
$config['dhcpdv6'][$if]['enable'] = ($_POST['enable']) ? true : false;
|
455 |
|
|
$config['dhcpdv6'][$if]['ddnsdomain'] = $_POST['ddnsdomain'];
|
456 |
87019fc4
|
Andres Petralli
|
$config['dhcpdv6'][$if]['ddnsdomainprimary'] = $_POST['ddnsdomainprimary'];
|
457 |
|
|
$config['dhcpdv6'][$if]['ddnsdomainkeyname'] = $_POST['ddnsdomainkeyname'];
|
458 |
|
|
$config['dhcpdv6'][$if]['ddnsdomainkey'] = $_POST['ddnsdomainkey'];
|
459 |
99caa67c
|
Seth Mos
|
$config['dhcpdv6'][$if]['ddnsupdate'] = ($_POST['ddnsupdate']) ? true : false;
|
460 |
391d63da
|
Renato Botelho
|
$config['dhcpdv6'][$if]['ddnsreverse'] = ($_POST['ddnsreverse']) ? true : false;
|
461 |
|
|
$config['dhcpdv6'][$if]['ddnsclientupdates'] = $_POST['ddnsclientupdates'];
|
462 |
99caa67c
|
Seth Mos
|
|
463 |
|
|
unset($config['dhcpdv6'][$if]['ntpserver']);
|
464 |
8f8682f7
|
Phil Davis
|
if ($_POST['ntp1']) {
|
465 |
99caa67c
|
Seth Mos
|
$config['dhcpdv6'][$if]['ntpserver'][] = $_POST['ntp1'];
|
466 |
8f8682f7
|
Phil Davis
|
}
|
467 |
|
|
if ($_POST['ntp2']) {
|
468 |
99caa67c
|
Seth Mos
|
$config['dhcpdv6'][$if]['ntpserver'][] = $_POST['ntp2'];
|
469 |
8f8682f7
|
Phil Davis
|
}
|
470 |
99caa67c
|
Seth Mos
|
|
471 |
|
|
$config['dhcpdv6'][$if]['tftp'] = $_POST['tftp'];
|
472 |
|
|
$config['dhcpdv6'][$if]['ldap'] = $_POST['ldap'];
|
473 |
|
|
$config['dhcpdv6'][$if]['netboot'] = ($_POST['netboot']) ? true : false;
|
474 |
bd942860
|
Renato Botelho
|
$config['dhcpdv6'][$if]['bootfile_url'] = $_POST['bootfile_url'];
|
475 |
138208bf
|
Joecowboy
|
$config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'] = $_POST['dhcpv6leaseinlocaltime'];
|
476 |
99caa67c
|
Seth Mos
|
|
477 |
|
|
// Handle the custom options rowhelper
|
478 |
8f8682f7
|
Phil Davis
|
if (isset($config['dhcpdv6'][$if]['numberoptions']['item'])) {
|
479 |
99caa67c
|
Seth Mos
|
unset($config['dhcpdv6'][$if]['numberoptions']['item']);
|
480 |
8f8682f7
|
Phil Davis
|
}
|
481 |
99caa67c
|
Seth Mos
|
|
482 |
|
|
$config['dhcpdv6'][$if]['numberoptions'] = $numberoptions;
|
483 |
|
|
|
484 |
|
|
write_config();
|
485 |
|
|
|
486 |
8f36f87a
|
jim-p
|
$savemsg = dhcpv6_apply_changes($dhcpdv6_enable_changed);
|
487 |
99caa67c
|
Seth Mos
|
}
|
488 |
|
|
}
|
489 |
|
|
|
490 |
|
|
if ($_GET['act'] == "del") {
|
491 |
|
|
if ($a_maps[$_GET['id']]) {
|
492 |
|
|
unset($a_maps[$_GET['id']]);
|
493 |
|
|
write_config();
|
494 |
8f8682f7
|
Phil Davis
|
if (isset($config['dhcpdv6'][$if]['enable'])) {
|
495 |
99caa67c
|
Seth Mos
|
mark_subsystem_dirty('staticmapsv6');
|
496 |
8f8682f7
|
Phil Davis
|
if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstaticv6'])) {
|
497 |
99caa67c
|
Seth Mos
|
mark_subsystem_dirty('hosts');
|
498 |
8f8682f7
|
Phil Davis
|
}
|
499 |
99caa67c
|
Seth Mos
|
}
|
500 |
|
|
header("Location: services_dhcpv6.php?if={$if}");
|
501 |
|
|
exit;
|
502 |
|
|
}
|
503 |
|
|
}
|
504 |
|
|
|
505 |
46b7214c
|
k-paulius
|
$pgtitle = array(gettext("Services"), htmlspecialchars(gettext("DHCPv6 Server & RA")));
|
506 |
253fa019
|
k-paulius
|
|
507 |
|
|
if (!empty($if) && !$dhcrelay_enabled && isset($iflist[$if])) {
|
508 |
|
|
$pgtitle[] = $iflist[$if];
|
509 |
9c06758b
|
k-paulius
|
$pgtitle[] = gettext("DHCPv6 Server");
|
510 |
253fa019
|
k-paulius
|
}
|
511 |
b32dd0a6
|
jim-p
|
$shortcut_section = "dhcp6";
|
512 |
99caa67c
|
Seth Mos
|
|
513 |
|
|
include("head.inc");
|
514 |
|
|
|
515 |
6e3488e9
|
Phil Davis
|
if ($input_errors) {
|
516 |
cd2c7940
|
sbeaver
|
print_input_errors($input_errors);
|
517 |
6e3488e9
|
Phil Davis
|
}
|
518 |
99caa67c
|
Seth Mos
|
|
519 |
6e3488e9
|
Phil Davis
|
if ($savemsg) {
|
520 |
cd2c7940
|
sbeaver
|
print_info_box($savemsg, 'success');
|
521 |
6e3488e9
|
Phil Davis
|
}
|
522 |
99caa67c
|
Seth Mos
|
|
523 |
cd2c7940
|
sbeaver
|
if ($dhcrelay_enabled) {
|
524 |
9c06758b
|
k-paulius
|
print_info_box(gettext("DHCPv6 Relay is currently enabled. Cannot enable the DHCPv6 Server service while the DHCPv6 Relay is enabled on any interface."), 'danger', false);
|
525 |
cd2c7940
|
sbeaver
|
include("foot.inc");
|
526 |
|
|
exit;
|
527 |
|
|
}
|
528 |
99caa67c
|
Seth Mos
|
|
529 |
6e3488e9
|
Phil Davis
|
if (is_subsystem_dirty('staticmaps')) {
|
530 |
464358b4
|
Phil Davis
|
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.'));
|
531 |
6e3488e9
|
Phil Davis
|
}
|
532 |
99caa67c
|
Seth Mos
|
|
533 |
cd2c7940
|
sbeaver
|
/* active tabs */
|
534 |
|
|
$tab_array = array();
|
535 |
|
|
$tabscounter = 0;
|
536 |
|
|
$i = 0;
|
537 |
c80e6a6a
|
Stephen Beaver
|
|
538 |
cd2c7940
|
sbeaver
|
foreach ($iflist as $ifent => $ifname) {
|
539 |
|
|
$oc = $config['interfaces'][$ifent];
|
540 |
2bf455ca
|
Renato Botelho
|
$valid_if_ipaddrv6 = (bool) ($oc['ipaddrv6'] == 'track6' ||
|
541 |
|
|
(is_ipaddrv6($oc['ipaddrv6']) &&
|
542 |
|
|
!is_linklocal($oc['ipaddrv6'])));
|
543 |
c80e6a6a
|
Stephen Beaver
|
|
544 |
8f928dc3
|
Renato Botelho
|
if ((!is_array($config['dhcpdv6'][$ifent]) ||
|
545 |
|
|
!isset($config['dhcpdv6'][$ifent]['enable'])) &&
|
546 |
|
|
!$valid_if_ipaddrv6) {
|
547 |
cd2c7940
|
sbeaver
|
continue;
|
548 |
6e3488e9
|
Phil Davis
|
}
|
549 |
cd2c7940
|
sbeaver
|
|
550 |
6e3488e9
|
Phil Davis
|
if ($ifent == $if) {
|
551 |
cd2c7940
|
sbeaver
|
$active = true;
|
552 |
6e3488e9
|
Phil Davis
|
} else {
|
553 |
cd2c7940
|
sbeaver
|
$active = false;
|
554 |
6e3488e9
|
Phil Davis
|
}
|
555 |
cd2c7940
|
sbeaver
|
|
556 |
|
|
$tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}");
|
557 |
|
|
$tabscounter++;
|
558 |
|
|
}
|
559 |
c80e6a6a
|
Stephen Beaver
|
|
560 |
cd2c7940
|
sbeaver
|
/* tack on PPPoE or PPtP servers here */
|
561 |
|
|
/* pppoe server */
|
562 |
|
|
if (is_array($config['pppoes']['pppoe'])) {
|
563 |
6e3488e9
|
Phil Davis
|
foreach ($config['pppoes']['pppoe'] as $pppoe) {
|
564 |
cd2c7940
|
sbeaver
|
if ($pppoe['mode'] == "server") {
|
565 |
|
|
$ifent = "poes". $pppoe['pppoeid'];
|
566 |
|
|
$ifname = strtoupper($ifent);
|
567 |
|
|
|
568 |
6e3488e9
|
Phil Davis
|
if ($ifent == $if) {
|
569 |
cd2c7940
|
sbeaver
|
$active = true;
|
570 |
6e3488e9
|
Phil Davis
|
} else {
|
571 |
cd2c7940
|
sbeaver
|
$active = false;
|
572 |
6e3488e9
|
Phil Davis
|
}
|
573 |
cd2c7940
|
sbeaver
|
|
574 |
|
|
$tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}");
|
575 |
|
|
$tabscounter++;
|
576 |
|
|
}
|
577 |
99caa67c
|
Seth Mos
|
}
|
578 |
cd2c7940
|
sbeaver
|
}
|
579 |
99caa67c
|
Seth Mos
|
|
580 |
c80e6a6a
|
Stephen Beaver
|
if ($tabscounter == 0) {
|
581 |
cd2c7940
|
sbeaver
|
print_info_box(gettext("The DHCPv6 Server can only be enabled on interfaces configured with a static IPv6 address. This system has none."), 'danger');
|
582 |
|
|
include("foot.inc");
|
583 |
|
|
exit;
|
584 |
|
|
}
|
585 |
99caa67c
|
Seth Mos
|
|
586 |
9b54ac32
|
Stephen Beaver
|
display_top_tabs($tab_array);
|
587 |
|
|
|
588 |
cd2c7940
|
sbeaver
|
$tab_array = array();
|
589 |
|
|
$tab_array[] = array(gettext("DHCPv6 Server"), true, "services_dhcpv6.php?if={$if}");
|
590 |
|
|
$tab_array[] = array(gettext("Router Advertisements"), false, "services_router_advertisements.php?if={$if}");
|
591 |
6e3488e9
|
Phil Davis
|
display_top_tabs($tab_array, false, 'nav nav-tabs');
|
592 |
99caa67c
|
Seth Mos
|
|
593 |
8f58b51b
|
jim-p
|
$form = new Form();
|
594 |
cd2c7940
|
sbeaver
|
|
595 |
|
|
$section = new Form_Section('DHCPv6 Options');
|
596 |
|
|
|
597 |
|
|
$section->addInput(new Form_Checkbox(
|
598 |
|
|
'enable',
|
599 |
|
|
'DHCPv6 Server',
|
600 |
ea6649f7
|
sbeaver
|
'Enable DHCPv6 server on interface ' . $iflist[$if],
|
601 |
cd2c7940
|
sbeaver
|
$pconfig['enable']
|
602 |
9eeb91dd
|
Stephen Beaver
|
));
|
603 |
cd2c7940
|
sbeaver
|
|
604 |
6e3488e9
|
Phil Davis
|
if (is_ipaddrv6($ifcfgip)) {
|
605 |
cd2c7940
|
sbeaver
|
|
606 |
e1953efa
|
Chris Buechler
|
if ($ifcfgip == "::") {
|
607 |
|
|
$sntext = "Prefix Delegation";
|
608 |
|
|
} else {
|
609 |
|
|
$sntext = gen_subnetv6($ifcfgip, $ifcfgsn);
|
610 |
|
|
}
|
611 |
cd2c7940
|
sbeaver
|
$section->addInput(new Form_StaticText(
|
612 |
|
|
'Subnet',
|
613 |
e1953efa
|
Chris Buechler
|
$sntext
|
614 |
cd2c7940
|
sbeaver
|
));
|
615 |
|
|
|
616 |
|
|
$section->addInput(new Form_StaticText(
|
617 |
|
|
'Subnet Mask',
|
618 |
|
|
$ifcfgsn . ' bits'
|
619 |
|
|
));
|
620 |
|
|
|
621 |
|
|
$section->addInput(new Form_StaticText(
|
622 |
|
|
'Available Range',
|
623 |
|
|
$range_from = gen_subnetv6($ifcfgip, $ifcfgsn) . ' to ' . gen_subnetv6_max($ifcfgip, $ifcfgsn)
|
624 |
e1953efa
|
Chris Buechler
|
))->setHelp($trackifname ? 'Prefix Delegation subnet will be appended to the beginning of the defined range':'');
|
625 |
cd2c7940
|
sbeaver
|
}
|
626 |
|
|
|
627 |
6e3488e9
|
Phil Davis
|
if ($is_olsr_enabled) {
|
628 |
cd2c7940
|
sbeaver
|
$section->addInput(new Form_Select(
|
629 |
|
|
'netmask',
|
630 |
e32f02a5
|
Phil Davis
|
'Subnet Mask',
|
631 |
cd2c7940
|
sbeaver
|
$pconfig['netmask'],
|
632 |
|
|
array_combine(range(128, 1, -1), range(128, 1, -1))
|
633 |
|
|
));
|
634 |
|
|
}
|
635 |
|
|
|
636 |
|
|
$f1 = new Form_Input(
|
637 |
|
|
'range_from',
|
638 |
|
|
null,
|
639 |
|
|
'text',
|
640 |
|
|
$pconfig['range_from']
|
641 |
218600a2
|
Renato Botelho
|
);
|
642 |
|
|
|
643 |
|
|
$f1->setHelp('From');
|
644 |
cd2c7940
|
sbeaver
|
|
645 |
|
|
$f2 = new Form_Input(
|
646 |
|
|
'range_to',
|
647 |
|
|
null,
|
648 |
|
|
'text',
|
649 |
|
|
$pconfig['range_to']
|
650 |
218600a2
|
Renato Botelho
|
);
|
651 |
|
|
|
652 |
|
|
$f2->setHelp('To');
|
653 |
cd2c7940
|
sbeaver
|
|
654 |
|
|
$group = new Form_Group('Range');
|
655 |
|
|
|
656 |
|
|
$group->add($f1);
|
657 |
|
|
$group->add($f2);
|
658 |
|
|
|
659 |
|
|
$section->add($group);
|
660 |
|
|
|
661 |
|
|
$f1 = new Form_Input(
|
662 |
70f17067
|
Stephen Beaver
|
'prefixrange_from',
|
663 |
cd2c7940
|
sbeaver
|
null,
|
664 |
|
|
'text',
|
665 |
70f17067
|
Stephen Beaver
|
$pconfig['prefixrange_from']
|
666 |
218600a2
|
Renato Botelho
|
);
|
667 |
|
|
|
668 |
|
|
$f1->setHelp('From');
|
669 |
cd2c7940
|
sbeaver
|
|
670 |
|
|
$f2 = new Form_Input(
|
671 |
70f17067
|
Stephen Beaver
|
'prefixrange_to',
|
672 |
cd2c7940
|
sbeaver
|
null,
|
673 |
|
|
'text',
|
674 |
70f17067
|
Stephen Beaver
|
$pconfig['prefixrange_to']
|
675 |
218600a2
|
Renato Botelho
|
);
|
676 |
|
|
|
677 |
|
|
$f2->setHelp('To');
|
678 |
cd2c7940
|
sbeaver
|
|
679 |
|
|
$group = new Form_Group('Prefix Delegation Range');
|
680 |
|
|
|
681 |
|
|
$group->add($f1);
|
682 |
|
|
$group->add($f2);
|
683 |
|
|
|
684 |
|
|
$section->add($group);
|
685 |
|
|
|
686 |
|
|
$section->addInput(new Form_Select(
|
687 |
|
|
'prefixrange_length',
|
688 |
|
|
'Prefix Delegation Size',
|
689 |
|
|
$pconfig['prefixrange_length'],
|
690 |
|
|
array(
|
691 |
|
|
'48' => '48',
|
692 |
|
|
'52' => '52',
|
693 |
|
|
'56' => '56',
|
694 |
|
|
'60' => '60',
|
695 |
|
|
'62' => '62',
|
696 |
|
|
'63' => '63',
|
697 |
|
|
'64' => '64'
|
698 |
|
|
)
|
699 |
|
|
))->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.');
|
700 |
|
|
|
701 |
|
|
$group = new Form_Group('DNS Servers');
|
702 |
|
|
|
703 |
6e3488e9
|
Phil Davis
|
for ($i=1;$i<=4; $i++) {
|
704 |
cd2c7940
|
sbeaver
|
$group->add(new Form_input(
|
705 |
|
|
'dns' . $i,
|
706 |
|
|
null,
|
707 |
|
|
'text',
|
708 |
e32f02a5
|
Phil Davis
|
$pconfig['dns' . $i],
|
709 |
|
|
['placeholder' => 'DNS ' . $i]
|
710 |
|
|
));
|
711 |
cd2c7940
|
sbeaver
|
}
|
712 |
|
|
|
713 |
6e3488e9
|
Phil Davis
|
$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.');
|
714 |
cd2c7940
|
sbeaver
|
$section->add($group);
|
715 |
|
|
|
716 |
|
|
$section->addInput(new Form_Input(
|
717 |
|
|
'domain',
|
718 |
|
|
'Domain Name',
|
719 |
|
|
'text',
|
720 |
ea6649f7
|
sbeaver
|
$pconfig['domain']
|
721 |
cd2c7940
|
sbeaver
|
))->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. ');
|
722 |
|
|
|
723 |
|
|
$section->addInput(new Form_Input(
|
724 |
|
|
'domainsearchlist',
|
725 |
|
|
'Domain search list',
|
726 |
|
|
'text',
|
727 |
ea6649f7
|
sbeaver
|
$pconfig['domainsearchlist']
|
728 |
cd2c7940
|
sbeaver
|
))->setHelp('The DHCP server can optionally provide a domain search list. Use the semicolon character as separator');
|
729 |
|
|
|
730 |
|
|
$section->addInput(new Form_Input(
|
731 |
|
|
'deftime',
|
732 |
|
|
'Default lease time',
|
733 |
|
|
'text',
|
734 |
ea6649f7
|
sbeaver
|
$pconfig['deftime']
|
735 |
558a7c62
|
Chris Buechler
|
))->setHelp('Lease time in seconds. Used for clients that do not ask for a specific expiration time. ' . ' <br />' .
|
736 |
cd2c7940
|
sbeaver
|
'The default is 7200 seconds.');
|
737 |
|
|
|
738 |
|
|
$section->addInput(new Form_Input(
|
739 |
|
|
'maxtime',
|
740 |
|
|
'Max lease time',
|
741 |
|
|
'text',
|
742 |
ea6649f7
|
sbeaver
|
$pconfig['maxtime']
|
743 |
cd2c7940
|
sbeaver
|
))->setHelp('Maximum lease time for clients that ask for a specific expiration time.' . ' <br />' .
|
744 |
|
|
'The default is 86400 seconds.');
|
745 |
|
|
|
746 |
|
|
$section->addInput(new Form_Checkbox(
|
747 |
|
|
'dhcpv6leaseinlocaltime',
|
748 |
|
|
'Time Format Change',
|
749 |
|
|
'Change DHCPv6 display lease time from UTC to local time',
|
750 |
|
|
$pconfig['dhcpv6leaseinlocaltime']
|
751 |
|
|
))->setHelp('By default DHCPv6 leases are displayed in UTC time. ' .
|
752 |
|
|
'By checking this box DHCPv6 lease time will be displayed in local time and set to time zone selected. ' .
|
753 |
|
|
'This will be used for all DHCPv6 interfaces lease time.');
|
754 |
|
|
|
755 |
|
|
$btndyndns = new Form_Button(
|
756 |
|
|
'btndyndns',
|
757 |
3314e626
|
jim-p
|
'Advanced',
|
758 |
|
|
null,
|
759 |
|
|
'fa-cog'
|
760 |
cd2c7940
|
sbeaver
|
);
|
761 |
|
|
|
762 |
3314e626
|
jim-p
|
$btndyndns->addClass('btn-info btn-sm');
|
763 |
cd2c7940
|
sbeaver
|
|
764 |
|
|
$section->addInput(new Form_StaticText(
|
765 |
|
|
'Dynamic DNS',
|
766 |
3314e626
|
jim-p
|
$btndyndns
|
767 |
cd2c7940
|
sbeaver
|
));
|
768 |
|
|
|
769 |
|
|
$section->addInput(new Form_Checkbox(
|
770 |
|
|
'ddnsupdate',
|
771 |
|
|
'DHCP Registration',
|
772 |
|
|
'Enable registration of DHCP client names in DNS.',
|
773 |
|
|
$pconfig['ddnsupdate']
|
774 |
|
|
));
|
775 |
|
|
|
776 |
|
|
$section->addInput(new Form_Input(
|
777 |
|
|
'ddnsdomain',
|
778 |
|
|
'DDNS Domain',
|
779 |
|
|
'text',
|
780 |
ea6649f7
|
sbeaver
|
$pconfig['ddnsdomain']
|
781 |
cd2c7940
|
sbeaver
|
))->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.');
|
782 |
|
|
|
783 |
|
|
$section->addInput(new Form_IpAddress(
|
784 |
|
|
'ddnsdomainprimary',
|
785 |
|
|
'DDNS Server IP',
|
786 |
ea6649f7
|
sbeaver
|
$pconfig['ddnsdomainprimary']
|
787 |
cd2c7940
|
sbeaver
|
))->setHelp('Enter the primary domain name server IP address for the dynamic domain name.');
|
788 |
|
|
|
789 |
|
|
$section->addInput(new Form_Input(
|
790 |
|
|
'ddnsdomainkeyname',
|
791 |
|
|
'DDNS Domain Key name',
|
792 |
|
|
'text',
|
793 |
ea6649f7
|
sbeaver
|
$pconfig['ddnsdomainkeyname']
|
794 |
cd2c7940
|
sbeaver
|
))->setHelp('Enter the dynamic DNS domain key name which will be used to register client names in the DNS server.');
|
795 |
|
|
|
796 |
|
|
$section->addInput(new Form_Input(
|
797 |
|
|
'ddnsdomainkey',
|
798 |
|
|
'DDNS Domain Key secret',
|
799 |
|
|
'text',
|
800 |
ea6649f7
|
sbeaver
|
$pconfig['ddnsdomainkey']
|
801 |
cd2c7940
|
sbeaver
|
))->setHelp('Enter the dynamic DNS domain key secret which will be used to register client names in the DNS server.');
|
802 |
|
|
|
803 |
391d63da
|
Renato Botelho
|
$section->addInput(new Form_Select(
|
804 |
|
|
'ddnsclientupdates',
|
805 |
|
|
'DDNS Client Updates',
|
806 |
|
|
$pconfig['ddnsclientupdates'],
|
807 |
|
|
array(
|
808 |
|
|
'allow' => gettext('Allow'),
|
809 |
|
|
'deny' => gettext('Deny'),
|
810 |
|
|
'ignore' => gettext('Ignore'))
|
811 |
|
|
))->setHelp('How Forward entries are handled when client indicates they wish to update DNS. ' .
|
812 |
|
|
'Allow prevents DHCP from updating Forward entries, Deny indicates that DHCP will ' .
|
813 |
|
|
'do the updates and the client should not, Ignore specifies that DHCP will do the ' .
|
814 |
|
|
'update and the client can also attempt the update usually using a different domain name.');
|
815 |
|
|
|
816 |
|
|
$section->addInput(new Form_Checkbox(
|
817 |
|
|
'ddnsreverse',
|
818 |
|
|
'DDNS Reverse',
|
819 |
|
|
'Add reverse dynamic DNS entries.',
|
820 |
|
|
$pconfig['ddnsreverse']
|
821 |
|
|
));
|
822 |
|
|
|
823 |
cd2c7940
|
sbeaver
|
$btnntp = new Form_Button(
|
824 |
|
|
'btnntp',
|
825 |
3314e626
|
jim-p
|
'Advanced',
|
826 |
|
|
null,
|
827 |
|
|
'fa-cog'
|
828 |
cd2c7940
|
sbeaver
|
);
|
829 |
|
|
|
830 |
3314e626
|
jim-p
|
$btnntp->addClass('btn-info btn-sm');
|
831 |
cd2c7940
|
sbeaver
|
|
832 |
|
|
$section->addInput(new Form_StaticText(
|
833 |
|
|
'NTP servers',
|
834 |
3314e626
|
jim-p
|
$btnntp
|
835 |
cd2c7940
|
sbeaver
|
));
|
836 |
|
|
|
837 |
|
|
$group = new Form_Group('NTP Servers');
|
838 |
|
|
|
839 |
|
|
$group->add(new Form_Input(
|
840 |
|
|
'ntp1',
|
841 |
|
|
'NTP Server 1',
|
842 |
|
|
'text',
|
843 |
ea6649f7
|
sbeaver
|
$pconfig['ntp1'],
|
844 |
cd2c7940
|
sbeaver
|
['placeholder' => 'NTP 1']
|
845 |
|
|
));
|
846 |
|
|
|
847 |
|
|
$group->add(new Form_Input(
|
848 |
|
|
'ntp2',
|
849 |
e32f02a5
|
Phil Davis
|
'NTP Server 2',
|
850 |
cd2c7940
|
sbeaver
|
'text',
|
851 |
ea6649f7
|
sbeaver
|
$pconfig['ntp2'],
|
852 |
cd2c7940
|
sbeaver
|
['placeholder' => 'NTP 2']
|
853 |
|
|
));
|
854 |
|
|
|
855 |
|
|
$group->addClass('ntpclass');
|
856 |
|
|
|
857 |
|
|
$section->add($group);
|
858 |
|
|
|
859 |
|
|
$btnldap = new Form_Button(
|
860 |
|
|
'btnldap',
|
861 |
3314e626
|
jim-p
|
'Advanced',
|
862 |
|
|
null,
|
863 |
|
|
'fa-cog'
|
864 |
cd2c7940
|
sbeaver
|
);
|
865 |
|
|
|
866 |
3314e626
|
jim-p
|
$btnldap->addClass('btn-info btn-sm');
|
867 |
cd2c7940
|
sbeaver
|
|
868 |
|
|
$section->addInput(new Form_StaticText(
|
869 |
|
|
'LDAP',
|
870 |
3314e626
|
jim-p
|
$btnldap
|
871 |
cd2c7940
|
sbeaver
|
));
|
872 |
|
|
|
873 |
|
|
$section->addInput(new Form_Input(
|
874 |
|
|
'ldap',
|
875 |
|
|
'LDAP URI',
|
876 |
|
|
'text',
|
877 |
ea6649f7
|
sbeaver
|
$pconfig['ldap']
|
878 |
cd2c7940
|
sbeaver
|
));
|
879 |
|
|
|
880 |
|
|
$btnnetboot = new Form_Button(
|
881 |
|
|
'btnnetboot',
|
882 |
3314e626
|
jim-p
|
'Advanced',
|
883 |
|
|
null,
|
884 |
|
|
'fa-cog'
|
885 |
cd2c7940
|
sbeaver
|
);
|
886 |
|
|
|
887 |
3314e626
|
jim-p
|
$btnnetboot->addClass('btn-info btn-sm');
|
888 |
cd2c7940
|
sbeaver
|
|
889 |
|
|
$section->addInput(new Form_StaticText(
|
890 |
|
|
'Network booting',
|
891 |
3314e626
|
jim-p
|
$btnnetboot
|
892 |
cd2c7940
|
sbeaver
|
));
|
893 |
|
|
|
894 |
|
|
$section->addInput(new Form_Checkbox(
|
895 |
|
|
'shownetboot',
|
896 |
|
|
'Network booting',
|
897 |
|
|
'Enable Network Booting',
|
898 |
|
|
$pconfig['shownetboot']
|
899 |
|
|
));
|
900 |
|
|
|
901 |
|
|
$section->addInput(new Form_Input(
|
902 |
|
|
'bootfile_url',
|
903 |
|
|
'Bootfile URL',
|
904 |
|
|
'text',
|
905 |
ea6649f7
|
sbeaver
|
$pconfig['bootfile_url']
|
906 |
cd2c7940
|
sbeaver
|
));
|
907 |
|
|
|
908 |
|
|
$btnadnl = new Form_Button(
|
909 |
|
|
'btnadnl',
|
910 |
3314e626
|
jim-p
|
'Advanced',
|
911 |
|
|
null,
|
912 |
|
|
'fa-cog'
|
913 |
cd2c7940
|
sbeaver
|
);
|
914 |
|
|
|
915 |
3314e626
|
jim-p
|
$btnadnl->addClass('btn-info btn-sm');
|
916 |
cd2c7940
|
sbeaver
|
|
917 |
|
|
$section->addInput(new Form_StaticText(
|
918 |
|
|
'Additional BOOTP/DHCP Options',
|
919 |
3314e626
|
jim-p
|
$btnadnl
|
920 |
cd2c7940
|
sbeaver
|
));
|
921 |
|
|
|
922 |
|
|
$form->add($section);
|
923 |
|
|
|
924 |
|
|
$title = 'Show Additional BOOTP/DHCP Options';
|
925 |
|
|
|
926 |
b090a0d9
|
Stephen Beaver
|
if (!$pconfig['numberoptions']) {
|
927 |
0716b616
|
Stephen Beaver
|
$noopts = true;
|
928 |
b090a0d9
|
Stephen Beaver
|
$pconfig['numberoptions']['item'] = array(0 => array('number' => "", 'value' => ""));
|
929 |
0716b616
|
Stephen Beaver
|
} else {
|
930 |
|
|
$noopts = false;
|
931 |
b090a0d9
|
Stephen Beaver
|
}
|
932 |
|
|
|
933 |
|
|
$counter = 0;
|
934 |
|
|
$last = count($pconfig['numberoptions']['item']) - 1;
|
935 |
|
|
|
936 |
|
|
foreach ($pconfig['numberoptions']['item'] as $item) {
|
937 |
|
|
$group = new Form_Group(null);
|
938 |
|
|
$group->addClass('repeatable');
|
939 |
0716b616
|
Stephen Beaver
|
$group->addClass('adnloptions');
|
940 |
b090a0d9
|
Stephen Beaver
|
|
941 |
|
|
$group->add(new Form_Input(
|
942 |
|
|
'number' . $counter,
|
943 |
|
|
null,
|
944 |
|
|
'text',
|
945 |
|
|
$item['number']
|
946 |
|
|
))->setHelp($counter == $last ? 'Number':null);
|
947 |
|
|
|
948 |
|
|
$group->add(new Form_Input(
|
949 |
|
|
'value' . $counter,
|
950 |
|
|
null,
|
951 |
|
|
'text',
|
952 |
|
|
base64_decode($item['value'])
|
953 |
|
|
))->setHelp($counter == $last ? 'Value':null);
|
954 |
|
|
|
955 |
|
|
$btn = new Form_Button(
|
956 |
|
|
'deleterow' . $counter,
|
957 |
cd7ddae6
|
jim-p
|
'Delete',
|
958 |
|
|
null,
|
959 |
|
|
'fa-trash'
|
960 |
b090a0d9
|
Stephen Beaver
|
);
|
961 |
|
|
|
962 |
cd7ddae6
|
jim-p
|
$btn->addClass('btn-warning');
|
963 |
b090a0d9
|
Stephen Beaver
|
$group->add($btn);
|
964 |
|
|
$section->add($group);
|
965 |
|
|
$counter++;
|
966 |
cd2c7940
|
sbeaver
|
}
|
967 |
|
|
|
968 |
b090a0d9
|
Stephen Beaver
|
|
969 |
cd2c7940
|
sbeaver
|
$btnaddopt = new Form_Button(
|
970 |
9eeb91dd
|
Stephen Beaver
|
'addrow',
|
971 |
cd7ddae6
|
jim-p
|
'Add Option',
|
972 |
|
|
null,
|
973 |
|
|
'fa-plus'
|
974 |
cd2c7940
|
sbeaver
|
);
|
975 |
|
|
|
976 |
9eeb91dd
|
Stephen Beaver
|
$btnaddopt->removeClass('btn-primary')->addClass('btn-success btn-sm');
|
977 |
cd2c7940
|
sbeaver
|
|
978 |
|
|
$section->addInput($btnaddopt);
|
979 |
|
|
|
980 |
|
|
$section->addInput(new Form_Input(
|
981 |
|
|
'if',
|
982 |
|
|
null,
|
983 |
|
|
'hidden',
|
984 |
|
|
$if
|
985 |
|
|
));
|
986 |
|
|
|
987 |
|
|
print($form);
|
988 |
b090a0d9
|
Stephen Beaver
|
|
989 |
f78bbe16
|
Phil Davis
|
?>
|
990 |
c95dabdd
|
Stephen Beaver
|
<div class="infoblock blockopen">
|
991 |
f78bbe16
|
Phil Davis
|
<?php
|
992 |
0a8a90f7
|
Phil Davis
|
print_info_box(
|
993 |
|
|
sprintf(
|
994 |
|
|
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.'),
|
995 |
|
|
'<a href="system.php">',
|
996 |
|
|
'<a href="services_dnsmasq.php"/>',
|
997 |
9eeb91dd
|
Stephen Beaver
|
'</a>') .
|
998 |
0a8a90f7
|
Phil Davis
|
'<br />' .
|
999 |
|
|
sprintf(
|
1000 |
|
|
gettext('The DHCP lease table can be viewed on the %1$sStatus: DHCPv6 leases%2$s page.'),
|
1001 |
|
|
'<a href="status_dhcpv6_leases.php">',
|
1002 |
|
|
'</a>'),
|
1003 |
|
|
'info',
|
1004 |
|
|
false);
|
1005 |
99caa67c
|
Seth Mos
|
?>
|
1006 |
f78bbe16
|
Phil Davis
|
</div>
|
1007 |
cd2c7940
|
sbeaver
|
<div class="panel panel-default">
|
1008 |
544af3fe
|
k-paulius
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("DHCPv6 Static Mappings for this Interface");?></h2></div>
|
1009 |
cd2c7940
|
sbeaver
|
<div class="panel-body table-responsive">
|
1010 |
|
|
<table class="table table-striped table-hover table-condensed">
|
1011 |
|
|
<thead>
|
1012 |
|
|
<tr>
|
1013 |
|
|
<th><?=gettext("DUID")?></th>
|
1014 |
|
|
<th><?=gettext("IPv6 address")?></th>
|
1015 |
|
|
<th><?=gettext("Hostname")?></th>
|
1016 |
|
|
<th><?=gettext("Description")?></th>
|
1017 |
|
|
<th><!-- Buttons --></th>
|
1018 |
|
|
</tr>
|
1019 |
|
|
</thead>
|
1020 |
|
|
<tbody>
|
1021 |
99caa67c
|
Seth Mos
|
<?php
|
1022 |
6e3488e9
|
Phil Davis
|
if (is_array($a_maps)):
|
1023 |
99caa67c
|
Seth Mos
|
$i = 0;
|
1024 |
cd2c7940
|
sbeaver
|
foreach ($a_maps as $mapent):
|
1025 |
6e3488e9
|
Phil Davis
|
if ($mapent['duid'] != "" or $mapent['ipaddrv6'] != ""):
|
1026 |
99caa67c
|
Seth Mos
|
?>
|
1027 |
cd2c7940
|
sbeaver
|
<tr>
|
1028 |
7d0ad4ec
|
Joecowboy
|
<td>
|
1029 |
cd2c7940
|
sbeaver
|
<?=htmlspecialchars($mapent['duid'])?>
|
1030 |
7d0ad4ec
|
Joecowboy
|
</td>
|
1031 |
|
|
<td>
|
1032 |
cd2c7940
|
sbeaver
|
<?=htmlspecialchars($mapent['ipaddrv6'])?>
|
1033 |
7d0ad4ec
|
Joecowboy
|
</td>
|
1034 |
|
|
<td>
|
1035 |
cd2c7940
|
sbeaver
|
<?=htmlspecialchars($mapent['hostname'])?>
|
1036 |
|
|
</td>
|
1037 |
|
|
<td>
|
1038 |
|
|
<?=htmlspecialchars($mapent['descr'])?>
|
1039 |
|
|
</td>
|
1040 |
|
|
<td>
|
1041 |
33f0b0d5
|
Stephen Beaver
|
<a class="fa fa-pencil" title="<?=gettext('Edit static mapping')?>" href="services_dhcpv6_edit.php?if=<?=$if?>&id=<?=$i?>"></a>
|
1042 |
|
|
<a class="fa fa-trash" title="<?=gettext('Delete static mapping')?>" href="services_dhcpv6.php?if=<?=$if?>&act=del&id=<?=$i?>"></a>
|
1043 |
7d0ad4ec
|
Joecowboy
|
</td>
|
1044 |
99caa67c
|
Seth Mos
|
</tr>
|
1045 |
cd2c7940
|
sbeaver
|
<?php
|
1046 |
|
|
endif;
|
1047 |
|
|
$i++;
|
1048 |
|
|
endforeach;
|
1049 |
|
|
endif;
|
1050 |
|
|
?>
|
1051 |
|
|
</tbody>
|
1052 |
99caa67c
|
Seth Mos
|
</table>
|
1053 |
|
|
</div>
|
1054 |
cd2c7940
|
sbeaver
|
</div>
|
1055 |
|
|
|
1056 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
1057 |
c9679d8c
|
Stephen Beaver
|
<a href="services_dhcpv6_edit.php?if=<?=$if?>" class="btn btn-sm btn-success"/>
|
1058 |
9d5a20cf
|
heper
|
<i class="fa fa-plus icon-embed-btn"></i>
|
1059 |
c9679d8c
|
Stephen Beaver
|
<?=gettext("Add")?>
|
1060 |
|
|
</a>
|
1061 |
cd2c7940
|
sbeaver
|
</nav>
|
1062 |
|
|
|
1063 |
8fd9052f
|
Colin Fleming
|
<script type="text/javascript">
|
1064 |
ee9530e1
|
Colin Fleming
|
//<![CDATA[
|
1065 |
6e3488e9
|
Phil Davis
|
events.push(function() {
|
1066 |
cd2c7940
|
sbeaver
|
|
1067 |
|
|
function hideDDNS(hide) {
|
1068 |
b090a0d9
|
Stephen Beaver
|
hideCheckbox('ddnsupdate', hide);
|
1069 |
cd2c7940
|
sbeaver
|
hideInput('ddnsdomain', hide);
|
1070 |
f495310d
|
Stephen Beaver
|
hideInput('ddnsdomainprimary', hide);
|
1071 |
cd2c7940
|
sbeaver
|
hideInput('ddnsdomainkeyname', hide);
|
1072 |
|
|
hideInput('ddnsdomainkey', hide);
|
1073 |
391d63da
|
Renato Botelho
|
hideInput('ddnsclientupdates', hide);
|
1074 |
|
|
hideCheckbox('ddnsreverse', hide);
|
1075 |
cd2c7940
|
sbeaver
|
}
|
1076 |
|
|
|
1077 |
2f5dafed
|
heper
|
// Make the 'Copy My MAC' button a plain button, not a submit button
|
1078 |
cd2c7940
|
sbeaver
|
$("#btnmymac").prop('type','button');
|
1079 |
|
|
|
1080 |
|
|
// On click, copy the hidden 'mymac' text to the 'mac' input
|
1081 |
|
|
$("#btnmymac").click(function() {
|
1082 |
|
|
$('#mac').val('<?=$mymac?>');
|
1083 |
|
|
});
|
1084 |
|
|
|
1085 |
2f5dafed
|
heper
|
// Make the 'tftp' button a plain button, not a submit button
|
1086 |
cd2c7940
|
sbeaver
|
$("#btntftp").prop('type','button');
|
1087 |
|
|
|
1088 |
|
|
// Show tftp controls
|
1089 |
|
|
$("#btntftp").click(function() {
|
1090 |
|
|
hideInput('tftp', false);
|
1091 |
|
|
});
|
1092 |
|
|
|
1093 |
2f5dafed
|
heper
|
// Make the 'ntp' button a plain button, not a submit button
|
1094 |
cd2c7940
|
sbeaver
|
$("#btnntp").prop('type','button');
|
1095 |
|
|
|
1096 |
|
|
// Show ntp controls
|
1097 |
|
|
$("#btnntp").click(function() {
|
1098 |
|
|
hideClass('ntpclass', false);
|
1099 |
|
|
});
|
1100 |
|
|
|
1101 |
2f5dafed
|
heper
|
// Make the 'ddns' button a plain button, not a submit button
|
1102 |
cd2c7940
|
sbeaver
|
$("#btndyndns").prop('type','button');
|
1103 |
|
|
|
1104 |
|
|
// Show ddns controls
|
1105 |
|
|
$("#btndyndns").click(function() {
|
1106 |
|
|
hideDDNS(false);
|
1107 |
|
|
});
|
1108 |
|
|
|
1109 |
2f5dafed
|
heper
|
// Make the 'ldap' button a plain button, not a submit button
|
1110 |
cd2c7940
|
sbeaver
|
$("#btnldap").prop('type','button');
|
1111 |
|
|
|
1112 |
|
|
// Show ldap controls
|
1113 |
|
|
$("#btnldap").click(function() {
|
1114 |
|
|
hideInput('ldap', false);
|
1115 |
|
|
});
|
1116 |
|
|
|
1117 |
2f5dafed
|
heper
|
// Make the 'netboot' button a plain button, not a submit button
|
1118 |
cd2c7940
|
sbeaver
|
$("#btnnetboot").prop('type','button');
|
1119 |
|
|
|
1120 |
|
|
// Show netboot controls
|
1121 |
|
|
$("#btnnetboot").click(function() {
|
1122 |
|
|
hideInput('bootfile_url', false);
|
1123 |
b090a0d9
|
Stephen Beaver
|
hideCheckbox('shownetboot', false);
|
1124 |
cd2c7940
|
sbeaver
|
});
|
1125 |
|
|
|
1126 |
e32f02a5
|
Phil Davis
|
// Make the 'additional options' button a plain button, not a submit button
|
1127 |
cd2c7940
|
sbeaver
|
$("#btnadnl").prop('type','button');
|
1128 |
|
|
|
1129 |
e32f02a5
|
Phil Davis
|
// Show additional controls
|
1130 |
cd2c7940
|
sbeaver
|
$("#btnadnl").click(function() {
|
1131 |
0716b616
|
Stephen Beaver
|
hideClass('adnloptions', false);
|
1132 |
9eeb91dd
|
Stephen Beaver
|
hideInput('addrow', false);
|
1133 |
|
|
checkLastRow();
|
1134 |
cd2c7940
|
sbeaver
|
});
|
1135 |
|
|
|
1136 |
0f0c4473
|
Renato Botelho
|
$('#enable').click(function() {
|
1137 |
|
|
do_toggle();
|
1138 |
|
|
});
|
1139 |
|
|
|
1140 |
|
|
function do_toggle() {
|
1141 |
|
|
if ($('#enable').prop('checked')) {
|
1142 |
|
|
$('.form-group:not(:first-child)').show();
|
1143 |
ad1188d9
|
Stephen Beaver
|
hideClass('adnloptions', <?php echo json_encode($noopts); ?>);
|
1144 |
|
|
hideInput('addrow', <?php echo json_encode($noopts); ?>);
|
1145 |
0f0c4473
|
Renato Botelho
|
} else {
|
1146 |
|
|
$('.form-group:not(:first-child)').hide();
|
1147 |
|
|
}
|
1148 |
9eeb91dd
|
Stephen Beaver
|
}
|
1149 |
|
|
|
1150 |
cd2c7940
|
sbeaver
|
// On initial load
|
1151 |
9eeb91dd
|
Stephen Beaver
|
do_toggle();
|
1152 |
cd2c7940
|
sbeaver
|
hideDDNS(true);
|
1153 |
|
|
hideClass('ntpclass', true);
|
1154 |
|
|
hideInput('tftp', true);
|
1155 |
|
|
hideInput('ldap', true);
|
1156 |
|
|
hideInput('bootfile_url', true);
|
1157 |
b090a0d9
|
Stephen Beaver
|
hideCheckbox('shownetboot', true);
|
1158 |
611cc5ca
|
Renato Botelho
|
if ($('#enable').prop('checked')) {
|
1159 |
|
|
hideClass('adnloptions', <?php echo json_encode($noopts); ?>);
|
1160 |
|
|
hideInput('addrow', <?php echo json_encode($noopts); ?>);
|
1161 |
|
|
} else {
|
1162 |
|
|
hideClass('adnloptions', true);
|
1163 |
|
|
hideInput('addrow', true);
|
1164 |
|
|
}
|
1165 |
9eeb91dd
|
Stephen Beaver
|
|
1166 |
cd2c7940
|
sbeaver
|
});
|
1167 |
ee9530e1
|
Colin Fleming
|
//]]>
|
1168 |
99caa67c
|
Seth Mos
|
</script>
|
1169 |
cd2c7940
|
sbeaver
|
|
1170 |
2f5dafed
|
heper
|
<?php include('foot.inc');
|