1 |
e9f147c8
|
Scott Ullrich
|
<?php
|
2 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
|
|
services_dhcp.php
|
5 |
|
|
part of m0n0wall (http://m0n0.ch/wall)
|
6 |
e9f147c8
|
Scott Ullrich
|
|
7 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
8 |
ed2d1343
|
Renato Botelho
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
9 |
5b237745
|
Scott Ullrich
|
All rights reserved.
|
10 |
e9f147c8
|
Scott Ullrich
|
|
11 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
12 |
|
|
modification, are permitted provided that the following conditions are met:
|
13 |
e9f147c8
|
Scott Ullrich
|
|
14 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
15 |
|
|
this list of conditions and the following disclaimer.
|
16 |
e9f147c8
|
Scott Ullrich
|
|
17 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
18 |
|
|
notice, this list of conditions and the following disclaimer in the
|
19 |
|
|
documentation and/or other materials provided with the distribution.
|
20 |
e9f147c8
|
Scott Ullrich
|
|
21 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
22 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
23 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
24 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
25 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
31 |
|
|
*/
|
32 |
1d333258
|
Scott Ullrich
|
/*
|
33 |
|
|
pfSense_BUILDER_BINARIES: /bin/rm
|
34 |
|
|
pfSense_MODULE: interfaces
|
35 |
|
|
*/
|
36 |
5b237745
|
Scott Ullrich
|
|
37 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
38 |
|
|
##|*IDENT=page-services-dhcpserver
|
39 |
|
|
##|*NAME=Services: DHCP server page
|
40 |
|
|
##|*DESCR=Allow access to the 'Services: DHCP server' page.
|
41 |
|
|
##|*MATCH=services_dhcp.php*
|
42 |
|
|
##|-PRIV
|
43 |
|
|
|
44 |
b7597d4e
|
Bill Marquette
|
require("guiconfig.inc");
|
45 |
6c124212
|
Phil Davis
|
require_once("filter.inc");
|
46 |
5b237745
|
Scott Ullrich
|
|
47 |
8f8682f7
|
Phil Davis
|
if (!$g['services_dhcp_server_enable']) {
|
48 |
6f3d2063
|
Renato Botelho
|
header("Location: /");
|
49 |
2ee0410f
|
Scott Ullrich
|
exit;
|
50 |
|
|
}
|
51 |
|
|
|
52 |
5b237745
|
Scott Ullrich
|
$if = $_GET['if'];
|
53 |
8f8682f7
|
Phil Davis
|
if (!empty($_POST['if'])) {
|
54 |
5b237745
|
Scott Ullrich
|
$if = $_POST['if'];
|
55 |
8f8682f7
|
Phil Davis
|
}
|
56 |
e9f147c8
|
Scott Ullrich
|
|
57 |
11bc553c
|
Scott Ullrich
|
/* if OLSRD is enabled, allow WAN to house DHCP. */
|
58 |
8f8682f7
|
Phil Davis
|
if ($config['installedpackages']['olsrd']) {
|
59 |
|
|
foreach ($config['installedpackages']['olsrd']['config'] as $olsrd) {
|
60 |
|
|
if ($olsrd['enable']) {
|
61 |
|
|
$is_olsr_enabled = true;
|
62 |
|
|
break;
|
63 |
|
|
}
|
64 |
a3b466b5
|
Scott Ullrich
|
}
|
65 |
8f8682f7
|
Phil Davis
|
}
|
66 |
5b237745
|
Scott Ullrich
|
|
67 |
934240ef
|
Ermal Luçi
|
$iflist = get_configured_interface_with_descr();
|
68 |
5b237745
|
Scott Ullrich
|
|
69 |
1c451b06
|
Scott Ullrich
|
/* set the starting interface */
|
70 |
f19651d1
|
Ermal
|
if (!$if || !isset($iflist[$if])) {
|
71 |
01fdb2d3
|
Erik Fonnesbeck
|
foreach ($iflist as $ifent => $ifname) {
|
72 |
de792e62
|
jim-p
|
$oc = $config['interfaces'][$ifent];
|
73 |
e5770bc2
|
Bill Marquette
|
if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddrv4($oc['ipaddr']))) ||
|
74 |
8f8682f7
|
Phil Davis
|
(!is_array($config['dhcpd'][$ifent]) && (!is_ipaddrv4($oc['ipaddr'])))) {
|
75 |
01fdb2d3
|
Erik Fonnesbeck
|
continue;
|
76 |
8f8682f7
|
Phil Davis
|
}
|
77 |
01fdb2d3
|
Erik Fonnesbeck
|
$if = $ifent;
|
78 |
|
|
break;
|
79 |
|
|
}
|
80 |
f19651d1
|
Ermal
|
}
|
81 |
0a2c6a5b
|
Scott Ullrich
|
|
82 |
cba980f6
|
jim-p
|
$act = $_GET['act'];
|
83 |
8f8682f7
|
Phil Davis
|
if (!empty($_POST['act'])) {
|
84 |
cba980f6
|
jim-p
|
$act = $_POST['act'];
|
85 |
8f8682f7
|
Phil Davis
|
}
|
86 |
cba980f6
|
jim-p
|
|
87 |
cc6052f0
|
Renato Botelho
|
$a_pools = array();
|
88 |
cba980f6
|
jim-p
|
|
89 |
8f8682f7
|
Phil Davis
|
if (is_array($config['dhcpd'][$if])) {
|
90 |
cba980f6
|
jim-p
|
$pool = $_GET['pool'];
|
91 |
8f8682f7
|
Phil Davis
|
if (is_numeric($_POST['pool'])) {
|
92 |
cba980f6
|
jim-p
|
$pool = $_POST['pool'];
|
93 |
8f8682f7
|
Phil Davis
|
}
|
94 |
cba980f6
|
jim-p
|
|
95 |
|
|
// If we have a pool but no interface name, that's not valid. Redirect away.
|
96 |
|
|
if (is_numeric($pool) && empty($if)) {
|
97 |
|
|
header("Location: services_dhcp.php");
|
98 |
|
|
exit;
|
99 |
de792e62
|
jim-p
|
}
|
100 |
cba980f6
|
jim-p
|
|
101 |
8f8682f7
|
Phil Davis
|
if (!is_array($config['dhcpd'][$if]['pool'])) {
|
102 |
cba980f6
|
jim-p
|
$config['dhcpd'][$if]['pool'] = array();
|
103 |
8f8682f7
|
Phil Davis
|
}
|
104 |
cba980f6
|
jim-p
|
$a_pools = &$config['dhcpd'][$if]['pool'];
|
105 |
|
|
|
106 |
8f8682f7
|
Phil Davis
|
if (is_numeric($pool) && $a_pools[$pool]) {
|
107 |
cba980f6
|
jim-p
|
$dhcpdconf = &$a_pools[$pool];
|
108 |
8f8682f7
|
Phil Davis
|
} elseif ($act == "newpool") {
|
109 |
cba980f6
|
jim-p
|
$dhcpdconf = array();
|
110 |
8f8682f7
|
Phil Davis
|
} else {
|
111 |
cba980f6
|
jim-p
|
$dhcpdconf = &$config['dhcpd'][$if];
|
112 |
8f8682f7
|
Phil Davis
|
}
|
113 |
cba980f6
|
jim-p
|
}
|
114 |
|
|
if (is_array($dhcpdconf)) {
|
115 |
|
|
// Global Options
|
116 |
|
|
if (!is_numeric($pool) && !($act == "newpool")) {
|
117 |
|
|
$pconfig['enable'] = isset($dhcpdconf['enable']);
|
118 |
|
|
$pconfig['staticarp'] = isset($dhcpdconf['staticarp']);
|
119 |
|
|
// No reason to specify this per-pool, per the dhcpd.conf man page it needs to be in every
|
120 |
|
|
// pool and should be specified in every pool both nodes share, so we'll treat it as global
|
121 |
|
|
$pconfig['failover_peerip'] = $dhcpdconf['failover_peerip'];
|
122 |
466aae83
|
Phil Davis
|
|
123 |
|
|
// dhcpleaseinlocaltime is global to all interfaces. So if it is selected on any interface,
|
124 |
|
|
// then show it true/checked.
|
125 |
|
|
foreach ($config['dhcpd'] as $dhcpdifitem) {
|
126 |
|
|
$dhcpleaseinlocaltime = $dhcpdifitem['dhcpleaseinlocaltime'];
|
127 |
8f8682f7
|
Phil Davis
|
if ($dhcpleaseinlocaltime) {
|
128 |
466aae83
|
Phil Davis
|
break;
|
129 |
8f8682f7
|
Phil Davis
|
}
|
130 |
466aae83
|
Phil Davis
|
}
|
131 |
|
|
|
132 |
|
|
$pconfig['dhcpleaseinlocaltime'] = $dhcpleaseinlocaltime;
|
133 |
|
|
|
134 |
8f8682f7
|
Phil Davis
|
if (!is_array($dhcpdconf['staticmap'])) {
|
135 |
cba980f6
|
jim-p
|
$dhcpdconf['staticmap'] = array();
|
136 |
8f8682f7
|
Phil Davis
|
}
|
137 |
cba980f6
|
jim-p
|
$a_maps = &$dhcpdconf['staticmap'];
|
138 |
ee1fb205
|
jim-p
|
} else {
|
139 |
|
|
// Options that exist only in pools
|
140 |
|
|
$pconfig['descr'] = $dhcpdconf['descr'];
|
141 |
cba980f6
|
jim-p
|
}
|
142 |
|
|
|
143 |
|
|
// Options that can be global or per-pool.
|
144 |
|
|
if (is_array($dhcpdconf['range'])) {
|
145 |
|
|
$pconfig['range_from'] = $dhcpdconf['range']['from'];
|
146 |
|
|
$pconfig['range_to'] = $dhcpdconf['range']['to'];
|
147 |
|
|
}
|
148 |
|
|
$pconfig['deftime'] = $dhcpdconf['defaultleasetime'];
|
149 |
|
|
$pconfig['maxtime'] = $dhcpdconf['maxleasetime'];
|
150 |
|
|
$pconfig['gateway'] = $dhcpdconf['gateway'];
|
151 |
|
|
$pconfig['domain'] = $dhcpdconf['domain'];
|
152 |
|
|
$pconfig['domainsearchlist'] = $dhcpdconf['domainsearchlist'];
|
153 |
8f8682f7
|
Phil Davis
|
list($pconfig['wins1'], $pconfig['wins2']) = $dhcpdconf['winsserver'];
|
154 |
|
|
list($pconfig['dns1'], $pconfig['dns2'], $pconfig['dns3'], $pconfig['dns4']) = $dhcpdconf['dnsserver'];
|
155 |
cba980f6
|
jim-p
|
$pconfig['denyunknown'] = isset($dhcpdconf['denyunknown']);
|
156 |
|
|
$pconfig['ddnsdomain'] = $dhcpdconf['ddnsdomain'];
|
157 |
87019fc4
|
Andres Petralli
|
$pconfig['ddnsdomainprimary'] = $dhcpdconf['ddnsdomainprimary'];
|
158 |
|
|
$pconfig['ddnsdomainkeyname'] = $dhcpdconf['ddnsdomainkeyname'];
|
159 |
|
|
$pconfig['ddnsdomainkey'] = $dhcpdconf['ddnsdomainkey'];
|
160 |
cba980f6
|
jim-p
|
$pconfig['ddnsupdate'] = isset($dhcpdconf['ddnsupdate']);
|
161 |
|
|
$pconfig['mac_allow'] = $dhcpdconf['mac_allow'];
|
162 |
|
|
$pconfig['mac_deny'] = $dhcpdconf['mac_deny'];
|
163 |
8f8682f7
|
Phil Davis
|
list($pconfig['ntp1'], $pconfig['ntp2']) = $dhcpdconf['ntpserver'];
|
164 |
cba980f6
|
jim-p
|
$pconfig['tftp'] = $dhcpdconf['tftp'];
|
165 |
|
|
$pconfig['ldap'] = $dhcpdconf['ldap'];
|
166 |
|
|
$pconfig['netboot'] = isset($dhcpdconf['netboot']);
|
167 |
|
|
$pconfig['nextserver'] = $dhcpdconf['nextserver'];
|
168 |
|
|
$pconfig['filename'] = $dhcpdconf['filename'];
|
169 |
7023c602
|
Charlie Root
|
$pconfig['filename32'] = $dhcpdconf['filename32'];
|
170 |
|
|
$pconfig['filename64'] = $dhcpdconf['filename64'];
|
171 |
cba980f6
|
jim-p
|
$pconfig['rootpath'] = $dhcpdconf['rootpath'];
|
172 |
|
|
$pconfig['netmask'] = $dhcpdconf['netmask'];
|
173 |
|
|
$pconfig['numberoptions'] = $dhcpdconf['numberoptions'];
|
174 |
89019922
|
Ermal Luçi
|
}
|
175 |
31c59d0d
|
Scott Ullrich
|
|
176 |
51cd7a1e
|
Evgeny Yurchenko
|
$ifcfgip = $config['interfaces'][$if]['ipaddr'];
|
177 |
|
|
$ifcfgsn = $config['interfaces'][$if]['subnet'];
|
178 |
5b237745
|
Scott Ullrich
|
|
179 |
1f1a08c8
|
jim-p
|
function validate_partial_mac_list($maclist) {
|
180 |
|
|
$macs = explode(',', $maclist);
|
181 |
|
|
|
182 |
|
|
// Loop through and look for invalid MACs.
|
183 |
8f8682f7
|
Phil Davis
|
foreach ($macs as $mac) {
|
184 |
|
|
if (!is_macaddr($mac, true)) {
|
185 |
1f1a08c8
|
jim-p
|
return false;
|
186 |
8f8682f7
|
Phil Davis
|
}
|
187 |
|
|
}
|
188 |
1f1a08c8
|
jim-p
|
return true;
|
189 |
|
|
}
|
190 |
|
|
|
191 |
565488c9
|
Renato Botelho
|
if (isset($_POST['submit'])) {
|
192 |
5b237745
|
Scott Ullrich
|
|
193 |
|
|
unset($input_errors);
|
194 |
b7597d4e
|
Bill Marquette
|
|
195 |
5b237745
|
Scott Ullrich
|
$pconfig = $_POST;
|
196 |
|
|
|
197 |
6d1af0e9
|
jim-p
|
$numberoptions = array();
|
198 |
6c07db48
|
Phil Davis
|
for ($x = 0; $x < 99; $x++) {
|
199 |
8f8682f7
|
Phil Davis
|
if (isset($_POST["number{$x}"]) && ctype_digit($_POST["number{$x}"])) {
|
200 |
6d1af0e9
|
jim-p
|
$numbervalue = array();
|
201 |
|
|
$numbervalue['number'] = htmlspecialchars($_POST["number{$x}"]);
|
202 |
678dfd0f
|
Erik Fonnesbeck
|
$numbervalue['type'] = htmlspecialchars($_POST["itemtype{$x}"]);
|
203 |
|
|
$numbervalue['value'] = str_replace('"', '"', htmlspecialchars($_POST["value{$x}"]));
|
204 |
6d1af0e9
|
jim-p
|
$numberoptions['item'][] = $numbervalue;
|
205 |
|
|
}
|
206 |
|
|
}
|
207 |
466aae83
|
Phil Davis
|
// Reload the new pconfig variable that the form uses.
|
208 |
6d1af0e9
|
jim-p
|
$pconfig['numberoptions'] = $numberoptions;
|
209 |
|
|
|
210 |
5b237745
|
Scott Ullrich
|
/* input validation */
|
211 |
cba980f6
|
jim-p
|
if ($_POST['enable'] || is_numeric($pool) || $act == "newpool") {
|
212 |
5b237745
|
Scott Ullrich
|
$reqdfields = explode(" ", "range_from range_to");
|
213 |
8f8682f7
|
Phil Davis
|
$reqdfieldsn = array(gettext("Range begin"), gettext("Range end"));
|
214 |
e9f147c8
|
Scott Ullrich
|
|
215 |
507628d5
|
Renato Botelho
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
|
216 |
de792e62
|
jim-p
|
|
217 |
8f8682f7
|
Phil Davis
|
if (($_POST['range_from'] && !is_ipaddrv4($_POST['range_from']))) {
|
218 |
40ad67e0
|
Rafael Lucas
|
$input_errors[] = gettext("A valid range must be specified.");
|
219 |
8f8682f7
|
Phil Davis
|
}
|
220 |
|
|
if (($_POST['range_to'] && !is_ipaddrv4($_POST['range_to']))) {
|
221 |
40ad67e0
|
Rafael Lucas
|
$input_errors[] = gettext("A valid range must be specified.");
|
222 |
8f8682f7
|
Phil Davis
|
}
|
223 |
|
|
if (($_POST['gateway'] && $_POST['gateway'] != "none" && !is_ipaddrv4($_POST['gateway']))) {
|
224 |
40ad67e0
|
Rafael Lucas
|
$input_errors[] = gettext("A valid IP address must be specified for the gateway.");
|
225 |
8f8682f7
|
Phil Davis
|
}
|
226 |
|
|
if (($_POST['wins1'] && !is_ipaddrv4($_POST['wins1'])) || ($_POST['wins2'] && !is_ipaddrv4($_POST['wins2']))) {
|
227 |
40ad67e0
|
Rafael Lucas
|
$input_errors[] = gettext("A valid IP address must be specified for the primary/secondary WINS servers.");
|
228 |
8f8682f7
|
Phil Davis
|
}
|
229 |
9bc59815
|
Evgeny Yurchenko
|
$parent_ip = get_interface_ip($_POST['if']);
|
230 |
1bd021e3
|
timdufrane
|
if (is_ipaddrv4($parent_ip) && $_POST['gateway'] && $_POST['gateway'] != "none") {
|
231 |
9bc59815
|
Evgeny Yurchenko
|
$parent_sn = get_interface_subnet($_POST['if']);
|
232 |
8f8682f7
|
Phil Davis
|
if (!ip_in_subnet($_POST['gateway'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['if'], $_POST['gateway'])) {
|
233 |
9bc59815
|
Evgeny Yurchenko
|
$input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']);
|
234 |
8f8682f7
|
Phil Davis
|
}
|
235 |
45d1024d
|
Scott Ullrich
|
}
|
236 |
8f8682f7
|
Phil Davis
|
if (($_POST['dns1'] && !is_ipaddrv4($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddrv4($_POST['dns2'])) || ($_POST['dns3'] && !is_ipaddrv4($_POST['dns3'])) || ($_POST['dns4'] && !is_ipaddrv4($_POST['dns4']))) {
|
237 |
3b5707db
|
Phil Davis
|
$input_errors[] = gettext("A valid IP address must be specified for each of the DNS servers.");
|
238 |
8f8682f7
|
Phil Davis
|
}
|
239 |
26e3ca70
|
sullrich
|
|
240 |
8f8682f7
|
Phil Davis
|
if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60))) {
|
241 |
|
|
$input_errors[] = gettext("The default lease time must be at least 60 seconds.");
|
242 |
|
|
}
|
243 |
e680b2f9
|
Renato Botelho
|
|
244 |
|
|
if (isset($config['captiveportal']) && is_array($config['captiveportal'])) {
|
245 |
|
|
$deftime = 7200; // Default value if it's empty
|
246 |
8f8682f7
|
Phil Davis
|
if (is_numeric($_POST['deftime'])) {
|
247 |
e680b2f9
|
Renato Botelho
|
$deftime = $_POST['deftime'];
|
248 |
8f8682f7
|
Phil Davis
|
}
|
249 |
e680b2f9
|
Renato Botelho
|
|
250 |
|
|
foreach ($config['captiveportal'] as $cpZone => $cpdata) {
|
251 |
8f8682f7
|
Phil Davis
|
if (!isset($cpdata['enable'])) {
|
252 |
e680b2f9
|
Renato Botelho
|
continue;
|
253 |
8f8682f7
|
Phil Davis
|
}
|
254 |
|
|
if (!isset($cpdata['timeout']) || !is_numeric($cpdata['timeout'])) {
|
255 |
e680b2f9
|
Renato Botelho
|
continue;
|
256 |
8f8682f7
|
Phil Davis
|
}
|
257 |
e680b2f9
|
Renato Botelho
|
$cp_ifs = explode(',', $cpdata['interface']);
|
258 |
8f8682f7
|
Phil Davis
|
if (!in_array($if, $cp_ifs)) {
|
259 |
e680b2f9
|
Renato Botelho
|
continue;
|
260 |
8f8682f7
|
Phil Davis
|
}
|
261 |
|
|
if ($cpdata['timeout'] > $deftime) {
|
262 |
e680b2f9
|
Renato Botelho
|
$input_errors[] = sprintf(gettext(
|
263 |
|
|
"The Captive Portal zone '%s' has Hard Timeout parameter set to a value bigger than Default lease time (%s)."), $cpZone, $deftime);
|
264 |
8f8682f7
|
Phil Davis
|
}
|
265 |
e680b2f9
|
Renato Botelho
|
}
|
266 |
|
|
}
|
267 |
|
|
|
268 |
8f8682f7
|
Phil Davis
|
if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime']))) {
|
269 |
40ad67e0
|
Rafael Lucas
|
$input_errors[] = gettext("The maximum lease time must be at least 60 seconds and higher than the default lease time.");
|
270 |
8f8682f7
|
Phil Davis
|
}
|
271 |
|
|
if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain']))) {
|
272 |
40ad67e0
|
Rafael Lucas
|
$input_errors[] = gettext("A valid domain name must be specified for the dynamic DNS registration.");
|
273 |
8f8682f7
|
Phil Davis
|
}
|
274 |
|
|
if (($_POST['ddnsdomain'] && !is_ipaddrv4($_POST['ddnsdomainprimary']))) {
|
275 |
87019fc4
|
Andres Petralli
|
$input_errors[] = gettext("A valid primary domain name server IP address must be specified for the dynamic domain name.");
|
276 |
8f8682f7
|
Phil Davis
|
}
|
277 |
87019fc4
|
Andres Petralli
|
if (($_POST['ddnsdomainkey'] && !$_POST['ddnsdomainkeyname']) ||
|
278 |
8f8682f7
|
Phil Davis
|
($_POST['ddnsdomainkeyname'] && !$_POST['ddnsdomainkey'])) {
|
279 |
87019fc4
|
Andres Petralli
|
$input_errors[] = gettext("You must specify both a valid domain key and key name.");
|
280 |
8f8682f7
|
Phil Davis
|
}
|
281 |
42a3cbab
|
Pierre POMES
|
if ($_POST['domainsearchlist']) {
|
282 |
8f8682f7
|
Phil Davis
|
$domain_array = preg_split("/[ ;]+/", $_POST['domainsearchlist']);
|
283 |
42a3cbab
|
Pierre POMES
|
foreach ($domain_array as $curdomain) {
|
284 |
|
|
if (!is_domain($curdomain)) {
|
285 |
|
|
$input_errors[] = gettext("A valid domain search list must be specified.");
|
286 |
|
|
break;
|
287 |
|
|
}
|
288 |
|
|
}
|
289 |
|
|
}
|
290 |
1f1a08c8
|
jim-p
|
|
291 |
|
|
// Validate MACs
|
292 |
8f8682f7
|
Phil Davis
|
if (!empty($_POST['mac_allow']) && !validate_partial_mac_list($_POST['mac_allow'])) {
|
293 |
1f1a08c8
|
jim-p
|
$input_errors[] = gettext("If you specify a mac allow list, it must contain only valid partial MAC addresses.");
|
294 |
8f8682f7
|
Phil Davis
|
}
|
295 |
|
|
if (!empty($_POST['mac_deny']) && !validate_partial_mac_list($_POST['mac_deny'])) {
|
296 |
1f1a08c8
|
jim-p
|
$input_errors[] = gettext("If you specify a mac deny list, it must contain only valid partial MAC addresses.");
|
297 |
8f8682f7
|
Phil Davis
|
}
|
298 |
1f1a08c8
|
jim-p
|
|
299 |
8f8682f7
|
Phil Davis
|
if (($_POST['ntp1'] && !is_ipaddrv4($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddrv4($_POST['ntp2']))) {
|
300 |
40ad67e0
|
Rafael Lucas
|
$input_errors[] = gettext("A valid IP address must be specified for the primary/secondary NTP servers.");
|
301 |
8f8682f7
|
Phil Davis
|
}
|
302 |
|
|
if (($_POST['domain'] && !is_domain($_POST['domain']))) {
|
303 |
40ad67e0
|
Rafael Lucas
|
$input_errors[] = gettext("A valid domain name must be specified for the DNS domain.");
|
304 |
8f8682f7
|
Phil Davis
|
}
|
305 |
|
|
if ($_POST['tftp'] && !is_ipaddrv4($_POST['tftp']) && !is_domain($_POST['tftp']) && !is_URL($_POST['tftp'])) {
|
306 |
40ad67e0
|
Rafael Lucas
|
$input_errors[] = gettext("A valid IP address or hostname must be specified for the TFTP server.");
|
307 |
8f8682f7
|
Phil Davis
|
}
|
308 |
|
|
if (($_POST['nextserver'] && !is_ipaddrv4($_POST['nextserver']))) {
|
309 |
40ad67e0
|
Rafael Lucas
|
$input_errors[] = gettext("A valid IP address must be specified for the network boot server.");
|
310 |
8f8682f7
|
Phil Davis
|
}
|
311 |
2c75b451
|
sullrich
|
|
312 |
8f8682f7
|
Phil Davis
|
if (gen_subnet($ifcfgip, $ifcfgsn) == $_POST['range_from']) {
|
313 |
40ad67e0
|
Rafael Lucas
|
$input_errors[] = gettext("You cannot use the network address in the starting subnet range.");
|
314 |
8f8682f7
|
Phil Davis
|
}
|
315 |
|
|
if (gen_subnet_max($ifcfgip, $ifcfgsn) == $_POST['range_to']) {
|
316 |
40ad67e0
|
Rafael Lucas
|
$input_errors[] = gettext("You cannot use the broadcast address in the ending subnet range.");
|
317 |
8f8682f7
|
Phil Davis
|
}
|
318 |
e9f147c8
|
Scott Ullrich
|
|
319 |
2c75b451
|
sullrich
|
// Disallow a range that includes the virtualip
|
320 |
7dfa60fa
|
Ermal Lu?i
|
if (is_array($config['virtualip']['vip'])) {
|
321 |
8f8682f7
|
Phil Davis
|
foreach ($config['virtualip']['vip'] as $vip) {
|
322 |
|
|
if ($vip['interface'] == $if) {
|
323 |
|
|
if ($vip['subnet'] && is_inrange_v4($vip['subnet'], $_POST['range_from'], $_POST['range_to'])) {
|
324 |
|
|
$input_errors[] = sprintf(gettext("The subnet range cannot overlap with virtual IP address %s."), $vip['subnet']);
|
325 |
|
|
}
|
326 |
|
|
}
|
327 |
7dfa60fa
|
Ermal Lu?i
|
}
|
328 |
2c75b451
|
sullrich
|
}
|
329 |
|
|
|
330 |
073a2697
|
jim-p
|
$noip = false;
|
331 |
8f8682f7
|
Phil Davis
|
if (is_array($a_maps)) {
|
332 |
|
|
foreach ($a_maps as $map) {
|
333 |
|
|
if (empty($map['ipaddr'])) {
|
334 |
2c7497cb
|
Scott Ullrich
|
$noip = true;
|
335 |
8f8682f7
|
Phil Davis
|
}
|
336 |
|
|
}
|
337 |
|
|
}
|
338 |
|
|
if ($_POST['staticarp'] && $noip) {
|
339 |
073a2697
|
jim-p
|
$input_errors[] = "Cannot enable static ARP when you have static map entries without IP addresses. Ensure all static maps have IP addresses and try again.";
|
340 |
8f8682f7
|
Phil Davis
|
}
|
341 |
073a2697
|
jim-p
|
|
342 |
8f8682f7
|
Phil Davis
|
if (is_array($pconfig['numberoptions']['item'])) {
|
343 |
678dfd0f
|
Erik Fonnesbeck
|
foreach ($pconfig['numberoptions']['item'] as $numberoption) {
|
344 |
8f8682f7
|
Phil Davis
|
if ($numberoption['type'] == 'text' && strstr($numberoption['value'], '"')) {
|
345 |
678dfd0f
|
Erik Fonnesbeck
|
$input_errors[] = gettext("Text type cannot include quotation marks.");
|
346 |
8f8682f7
|
Phil Davis
|
} else if ($numberoption['type'] == 'string' && !preg_match('/^"[^"]*"$/', $numberoption['value']) && !preg_match('/^[0-9a-f]{2}(?:\:[0-9a-f]{2})*$/i', $numberoption['value'])) {
|
347 |
678dfd0f
|
Erik Fonnesbeck
|
$input_errors[] = gettext("String type must be enclosed in quotes like \"this\" or must be a series of octets specified in hexadecimal, separated by colons, like 01:23:45:67:89:ab:cd:ef");
|
348 |
8f8682f7
|
Phil Davis
|
} else if ($numberoption['type'] == 'boolean' && $numberoption['value'] != 'true' && $numberoption['value'] != 'false' && $numberoption['value'] != 'on' && $numberoption['value'] != 'off') {
|
349 |
678dfd0f
|
Erik Fonnesbeck
|
$input_errors[] = gettext("Boolean type must be true, false, on, or off.");
|
350 |
8f8682f7
|
Phil Davis
|
} else if ($numberoption['type'] == 'unsigned integer 8' && (!is_numeric($numberoption['value']) || $numberoption['value'] < 0 || $numberoption['value'] > 255)) {
|
351 |
678dfd0f
|
Erik Fonnesbeck
|
$input_errors[] = gettext("Unsigned 8-bit integer type must be a number in the range 0 to 255.");
|
352 |
8f8682f7
|
Phil Davis
|
} else if ($numberoption['type'] == 'unsigned integer 16' && (!is_numeric($numberoption['value']) || $numberoption['value'] < 0 || $numberoption['value'] > 65535)) {
|
353 |
678dfd0f
|
Erik Fonnesbeck
|
$input_errors[] = gettext("Unsigned 16-bit integer type must be a number in the range 0 to 65535.");
|
354 |
8f8682f7
|
Phil Davis
|
} else if ($numberoption['type'] == 'unsigned integer 32' && (!is_numeric($numberoption['value']) || $numberoption['value'] < 0 || $numberoption['value'] > 4294967295)) {
|
355 |
678dfd0f
|
Erik Fonnesbeck
|
$input_errors[] = gettext("Unsigned 32-bit integer type must be a number in the range 0 to 4294967295.");
|
356 |
8f8682f7
|
Phil Davis
|
} else if ($numberoption['type'] == 'signed integer 8' && (!is_numeric($numberoption['value']) || $numberoption['value'] < -128 || $numberoption['value'] > 127)) {
|
357 |
678dfd0f
|
Erik Fonnesbeck
|
$input_errors[] = gettext("Signed 8-bit integer type must be a number in the range -128 to 127.");
|
358 |
8f8682f7
|
Phil Davis
|
} else if ($numberoption['type'] == 'signed integer 16' && (!is_numeric($numberoption['value']) || $numberoption['value'] < -32768 || $numberoption['value'] > 32767)) {
|
359 |
678dfd0f
|
Erik Fonnesbeck
|
$input_errors[] = gettext("Signed 16-bit integer type must be a number in the range -32768 to 32767.");
|
360 |
8f8682f7
|
Phil Davis
|
} else if ($numberoption['type'] == 'signed integer 32' && (!is_numeric($numberoption['value']) || $numberoption['value'] < -2147483648 || $numberoption['value'] > 2147483647)) {
|
361 |
678dfd0f
|
Erik Fonnesbeck
|
$input_errors[] = gettext("Signed 32-bit integer type must be a number in the range -2147483648 to 2147483647.");
|
362 |
8f8682f7
|
Phil Davis
|
} else if ($numberoption['type'] == 'ip-address' && !is_ipaddrv4($numberoption['value']) && !is_hostname($numberoption['value'])) {
|
363 |
678dfd0f
|
Erik Fonnesbeck
|
$input_errors[] = gettext("IP address or host type must be an IP address or host name.");
|
364 |
8f8682f7
|
Phil Davis
|
}
|
365 |
678dfd0f
|
Erik Fonnesbeck
|
}
|
366 |
|
|
}
|
367 |
|
|
|
368 |
5b237745
|
Scott Ullrich
|
if (!$input_errors) {
|
369 |
|
|
/* make sure the range lies within the current subnet */
|
370 |
96033063
|
Erik Fonnesbeck
|
$subnet_start = ip2ulong(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
|
371 |
|
|
$subnet_end = ip2ulong(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
|
372 |
e9f147c8
|
Scott Ullrich
|
|
373 |
96033063
|
Erik Fonnesbeck
|
if ((ip2ulong($_POST['range_from']) < $subnet_start) || (ip2ulong($_POST['range_from']) > $subnet_end) ||
|
374 |
|
|
(ip2ulong($_POST['range_to']) < $subnet_start) || (ip2ulong($_POST['range_to']) > $subnet_end)) {
|
375 |
40ad67e0
|
Rafael Lucas
|
$input_errors[] = gettext("The specified range lies outside of the current subnet.");
|
376 |
5b237745
|
Scott Ullrich
|
}
|
377 |
e9f147c8
|
Scott Ullrich
|
|
378 |
8f8682f7
|
Phil Davis
|
if (ip2ulong($_POST['range_from']) > ip2ulong($_POST['range_to'])) {
|
379 |
40ad67e0
|
Rafael Lucas
|
$input_errors[] = gettext("The range is invalid (first element higher than second element).");
|
380 |
8f8682f7
|
Phil Davis
|
}
|
381 |
e9f147c8
|
Scott Ullrich
|
|
382 |
f657f5e1
|
Renato Botelho
|
if (is_numeric($pool) || ($act == "newpool")) {
|
383 |
|
|
$rfrom = $config['dhcpd'][$if]['range']['from'];
|
384 |
|
|
$rto = $config['dhcpd'][$if]['range']['to'];
|
385 |
|
|
|
386 |
8f8682f7
|
Phil Davis
|
if (is_inrange_v4($_POST['range_from'], $rfrom, $rto) || is_inrange_v4($_POST['range_to'], $rfrom, $rto)) {
|
387 |
f657f5e1
|
Renato Botelho
|
$input_errors[] = gettext("The specified range must not be within the DHCP range for this interface.");
|
388 |
8f8682f7
|
Phil Davis
|
}
|
389 |
f657f5e1
|
Renato Botelho
|
}
|
390 |
|
|
|
391 |
|
|
foreach ($a_pools as $id => $p) {
|
392 |
8f8682f7
|
Phil Davis
|
if (is_numeric($pool) && ($id == $pool)) {
|
393 |
f657f5e1
|
Renato Botelho
|
continue;
|
394 |
8f8682f7
|
Phil Davis
|
}
|
395 |
f657f5e1
|
Renato Botelho
|
|
396 |
|
|
if (is_inrange_v4($_POST['range_from'], $p['range']['from'], $p['range']['to']) ||
|
397 |
|
|
is_inrange_v4($_POST['range_to'], $p['range']['from'], $p['range']['to'])) {
|
398 |
|
|
$input_errors[] = gettext("The specified range must not be within the range configured on a DHCP pool for this interface.");
|
399 |
|
|
break;
|
400 |
|
|
}
|
401 |
|
|
}
|
402 |
cba980f6
|
jim-p
|
|
403 |
5b237745
|
Scott Ullrich
|
/* make sure that the DHCP Relay isn't enabled on this interface */
|
404 |
8f8682f7
|
Phil Davis
|
if (isset($config['dhcrelay']['enable']) && (stristr($config['dhcrelay']['interface'], $if) !== false)) {
|
405 |
|
|
$input_errors[] = sprintf(gettext("You must disable the DHCP relay on the %s interface before enabling the DHCP server."), $iflist[$if]);
|
406 |
|
|
}
|
407 |
630d7025
|
jim-p
|
|
408 |
|
|
$dynsubnet_start = ip2ulong($_POST['range_from']);
|
409 |
|
|
$dynsubnet_end = ip2ulong($_POST['range_to']);
|
410 |
f02f0675
|
Erik Fonnesbeck
|
if (is_array($a_maps)) {
|
411 |
|
|
foreach ($a_maps as $map) {
|
412 |
8f8682f7
|
Phil Davis
|
if (empty($map['ipaddr'])) {
|
413 |
f02f0675
|
Erik Fonnesbeck
|
continue;
|
414 |
8f8682f7
|
Phil Davis
|
}
|
415 |
f02f0675
|
Erik Fonnesbeck
|
if ((ip2ulong($map['ipaddr']) > $dynsubnet_start) &&
|
416 |
8f8682f7
|
Phil Davis
|
(ip2ulong($map['ipaddr']) < $dynsubnet_end)) {
|
417 |
f02f0675
|
Erik Fonnesbeck
|
$input_errors[] = sprintf(gettext("The DHCP range cannot overlap any static DHCP mappings."));
|
418 |
|
|
break;
|
419 |
|
|
}
|
420 |
630d7025
|
jim-p
|
}
|
421 |
|
|
}
|
422 |
5b237745
|
Scott Ullrich
|
}
|
423 |
|
|
}
|
424 |
|
|
|
425 |
|
|
if (!$input_errors) {
|
426 |
cba980f6
|
jim-p
|
if (!is_numeric($pool)) {
|
427 |
|
|
if ($act == "newpool") {
|
428 |
|
|
$dhcpdconf = array();
|
429 |
|
|
} else {
|
430 |
8f8682f7
|
Phil Davis
|
if (!is_array($config['dhcpd'][$if])) {
|
431 |
cba980f6
|
jim-p
|
$config['dhcpd'][$if] = array();
|
432 |
8f8682f7
|
Phil Davis
|
}
|
433 |
cba980f6
|
jim-p
|
$dhcpdconf = $config['dhcpd'][$if];
|
434 |
|
|
}
|
435 |
|
|
} else {
|
436 |
|
|
if (is_array($a_pools[$pool])) {
|
437 |
|
|
$dhcpdconf = $a_pools[$pool];
|
438 |
|
|
} else {
|
439 |
|
|
// Someone specified a pool but it doesn't exist. Punt.
|
440 |
|
|
header("Location: services_dhcp.php");
|
441 |
|
|
exit;
|
442 |
|
|
}
|
443 |
|
|
}
|
444 |
8f8682f7
|
Phil Davis
|
if (!is_array($dhcpdconf['range'])) {
|
445 |
cba980f6
|
jim-p
|
$dhcpdconf['range'] = array();
|
446 |
8f8682f7
|
Phil Davis
|
}
|
447 |
cba980f6
|
jim-p
|
|
448 |
6c124212
|
Phil Davis
|
$dhcpd_enable_changed = false;
|
449 |
|
|
|
450 |
cba980f6
|
jim-p
|
// Global Options
|
451 |
|
|
if (!is_numeric($pool) && !($act == "newpool")) {
|
452 |
6c124212
|
Phil Davis
|
$old_dhcpd_enable = isset($dhcpdconf['enable']);
|
453 |
|
|
$new_dhcpd_enable = ($_POST['enable']) ? true : false;
|
454 |
|
|
if ($old_dhcpd_enable != $new_dhcpd_enable) {
|
455 |
|
|
/* DHCP has been enabled or disabled. The pf ruleset will need to be rebuilt to allow or disallow DHCP. */
|
456 |
|
|
$dhcpd_enable_changed = true;
|
457 |
|
|
}
|
458 |
|
|
$dhcpdconf['enable'] = $new_dhcpd_enable;
|
459 |
cba980f6
|
jim-p
|
$dhcpdconf['staticarp'] = ($_POST['staticarp']) ? true : false;
|
460 |
|
|
$previous = $dhcpdconf['failover_peerip'];
|
461 |
8f8682f7
|
Phil Davis
|
if ($previous <> $_POST['failover_peerip']) {
|
462 |
cba980f6
|
jim-p
|
mwexec("/bin/rm -rf /var/dhcpd/var/db/*");
|
463 |
8f8682f7
|
Phil Davis
|
}
|
464 |
cba980f6
|
jim-p
|
$dhcpdconf['failover_peerip'] = $_POST['failover_peerip'];
|
465 |
466aae83
|
Phil Davis
|
// dhcpleaseinlocaltime is global to all interfaces. So update the setting on all interfaces.
|
466 |
|
|
foreach ($config['dhcpd'] as &$dhcpdifitem) {
|
467 |
|
|
$dhcpdifitem['dhcpleaseinlocaltime'] = $_POST['dhcpleaseinlocaltime'];
|
468 |
|
|
}
|
469 |
ee1fb205
|
jim-p
|
} else {
|
470 |
|
|
// Options that exist only in pools
|
471 |
|
|
$dhcpdconf['descr'] = $_POST['descr'];
|
472 |
cba980f6
|
jim-p
|
}
|
473 |
|
|
|
474 |
|
|
// Options that can be global or per-pool.
|
475 |
|
|
$dhcpdconf['range']['from'] = $_POST['range_from'];
|
476 |
|
|
$dhcpdconf['range']['to'] = $_POST['range_to'];
|
477 |
|
|
$dhcpdconf['defaultleasetime'] = $_POST['deftime'];
|
478 |
|
|
$dhcpdconf['maxleasetime'] = $_POST['maxtime'];
|
479 |
|
|
$dhcpdconf['netmask'] = $_POST['netmask'];
|
480 |
|
|
|
481 |
|
|
unset($dhcpdconf['winsserver']);
|
482 |
8f8682f7
|
Phil Davis
|
if ($_POST['wins1']) {
|
483 |
cba980f6
|
jim-p
|
$dhcpdconf['winsserver'][] = $_POST['wins1'];
|
484 |
8f8682f7
|
Phil Davis
|
}
|
485 |
|
|
if ($_POST['wins2']) {
|
486 |
cba980f6
|
jim-p
|
$dhcpdconf['winsserver'][] = $_POST['wins2'];
|
487 |
8f8682f7
|
Phil Davis
|
}
|
488 |
4cab31d0
|
Scott Ullrich
|
|
489 |
cba980f6
|
jim-p
|
unset($dhcpdconf['dnsserver']);
|
490 |
8f8682f7
|
Phil Davis
|
if ($_POST['dns1']) {
|
491 |
cba980f6
|
jim-p
|
$dhcpdconf['dnsserver'][] = $_POST['dns1'];
|
492 |
8f8682f7
|
Phil Davis
|
}
|
493 |
|
|
if ($_POST['dns2']) {
|
494 |
cba980f6
|
jim-p
|
$dhcpdconf['dnsserver'][] = $_POST['dns2'];
|
495 |
8f8682f7
|
Phil Davis
|
}
|
496 |
|
|
if ($_POST['dns3']) {
|
497 |
3b5707db
|
Phil Davis
|
$dhcpdconf['dnsserver'][] = $_POST['dns3'];
|
498 |
8f8682f7
|
Phil Davis
|
}
|
499 |
|
|
if ($_POST['dns4']) {
|
500 |
3b5707db
|
Phil Davis
|
$dhcpdconf['dnsserver'][] = $_POST['dns4'];
|
501 |
8f8682f7
|
Phil Davis
|
}
|
502 |
cba980f6
|
jim-p
|
|
503 |
|
|
$dhcpdconf['gateway'] = $_POST['gateway'];
|
504 |
|
|
$dhcpdconf['domain'] = $_POST['domain'];
|
505 |
|
|
$dhcpdconf['domainsearchlist'] = $_POST['domainsearchlist'];
|
506 |
|
|
$dhcpdconf['denyunknown'] = ($_POST['denyunknown']) ? true : false;
|
507 |
|
|
$dhcpdconf['ddnsdomain'] = $_POST['ddnsdomain'];
|
508 |
87019fc4
|
Andres Petralli
|
$dhcpdconf['ddnsdomainprimary'] = $_POST['ddnsdomainprimary'];
|
509 |
|
|
$dhcpdconf['ddnsdomainkeyname'] = $_POST['ddnsdomainkeyname'];
|
510 |
|
|
$dhcpdconf['ddnsdomainkey'] = $_POST['ddnsdomainkey'];
|
511 |
cba980f6
|
jim-p
|
$dhcpdconf['ddnsupdate'] = ($_POST['ddnsupdate']) ? true : false;
|
512 |
|
|
$dhcpdconf['mac_allow'] = $_POST['mac_allow'];
|
513 |
|
|
$dhcpdconf['mac_deny'] = $_POST['mac_deny'];
|
514 |
|
|
|
515 |
|
|
unset($dhcpdconf['ntpserver']);
|
516 |
8f8682f7
|
Phil Davis
|
if ($_POST['ntp1']) {
|
517 |
cba980f6
|
jim-p
|
$dhcpdconf['ntpserver'][] = $_POST['ntp1'];
|
518 |
8f8682f7
|
Phil Davis
|
}
|
519 |
|
|
if ($_POST['ntp2']) {
|
520 |
cba980f6
|
jim-p
|
$dhcpdconf['ntpserver'][] = $_POST['ntp2'];
|
521 |
8f8682f7
|
Phil Davis
|
}
|
522 |
ad171999
|
Seth Mos
|
|
523 |
cba980f6
|
jim-p
|
$dhcpdconf['tftp'] = $_POST['tftp'];
|
524 |
|
|
$dhcpdconf['ldap'] = $_POST['ldap'];
|
525 |
|
|
$dhcpdconf['netboot'] = ($_POST['netboot']) ? true : false;
|
526 |
|
|
$dhcpdconf['nextserver'] = $_POST['nextserver'];
|
527 |
|
|
$dhcpdconf['filename'] = $_POST['filename'];
|
528 |
7023c602
|
Charlie Root
|
$dhcpdconf['filename32'] = $_POST['filename32'];
|
529 |
|
|
$dhcpdconf['filename64'] = $_POST['filename64'];
|
530 |
cba980f6
|
jim-p
|
$dhcpdconf['rootpath'] = $_POST['rootpath'];
|
531 |
9c748b70
|
Scott Ullrich
|
|
532 |
d72b4114
|
Scott Ullrich
|
// Handle the custom options rowhelper
|
533 |
8f8682f7
|
Phil Davis
|
if (isset($dhcpdconf['numberoptions']['item'])) {
|
534 |
cba980f6
|
jim-p
|
unset($dhcpdconf['numberoptions']['item']);
|
535 |
8f8682f7
|
Phil Davis
|
}
|
536 |
6d1af0e9
|
jim-p
|
|
537 |
cba980f6
|
jim-p
|
$dhcpdconf['numberoptions'] = $numberoptions;
|
538 |
|
|
|
539 |
|
|
if (is_numeric($pool) && is_array($a_pools[$pool])) {
|
540 |
|
|
$a_pools[$pool] = $dhcpdconf;
|
541 |
|
|
} elseif ($act == "newpool") {
|
542 |
|
|
$a_pools[] = $dhcpdconf;
|
543 |
|
|
} else {
|
544 |
|
|
$config['dhcpd'][$if] = $dhcpdconf;
|
545 |
|
|
}
|
546 |
518030b3
|
Scott Ullrich
|
|
547 |
5b237745
|
Scott Ullrich
|
write_config();
|
548 |
565488c9
|
Renato Botelho
|
}
|
549 |
|
|
}
|
550 |
80933129
|
Bill Marquette
|
|
551 |
48ac0aa0
|
Phil Davis
|
if ((isset($_POST['submit']) || isset($_POST['apply'])) && (!$input_errors)) {
|
552 |
565488c9
|
Renato Botelho
|
$retval = 0;
|
553 |
|
|
$retvaldhcp = 0;
|
554 |
|
|
$retvaldns = 0;
|
555 |
|
|
/* dnsmasq_configure calls dhcpd_configure */
|
556 |
|
|
/* no need to restart dhcpd twice */
|
557 |
|
|
if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic'])) {
|
558 |
|
|
$retvaldns = services_dnsmasq_configure();
|
559 |
|
|
if ($retvaldns == 0) {
|
560 |
|
|
clear_subsystem_dirty('hosts');
|
561 |
|
|
clear_subsystem_dirty('staticmaps');
|
562 |
de792e62
|
jim-p
|
}
|
563 |
565488c9
|
Renato Botelho
|
} else if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
|
564 |
|
|
$retvaldns = services_unbound_configure();
|
565 |
4230ad16
|
Phil Davis
|
if ($retvaldns == 0) {
|
566 |
565488c9
|
Renato Botelho
|
clear_subsystem_dirty('unbound');
|
567 |
d3801fdb
|
Renato Botelho
|
clear_subsystem_dirty('hosts');
|
568 |
|
|
clear_subsystem_dirty('staticmaps');
|
569 |
4230ad16
|
Phil Davis
|
}
|
570 |
565488c9
|
Renato Botelho
|
} else {
|
571 |
|
|
$retvaldhcp = services_dhcpd_configure();
|
572 |
8f8682f7
|
Phil Davis
|
if ($retvaldhcp == 0) {
|
573 |
565488c9
|
Renato Botelho
|
clear_subsystem_dirty('staticmaps');
|
574 |
8f8682f7
|
Phil Davis
|
}
|
575 |
5b237745
|
Scott Ullrich
|
}
|
576 |
8f8682f7
|
Phil Davis
|
if ($dhcpd_enable_changed) {
|
577 |
565488c9
|
Renato Botelho
|
$retvalfc = filter_configure();
|
578 |
8f8682f7
|
Phil Davis
|
}
|
579 |
565488c9
|
Renato Botelho
|
|
580 |
8f8682f7
|
Phil Davis
|
if ($retvaldhcp == 1 || $retvaldns == 1 || $retvalfc == 1) {
|
581 |
565488c9
|
Renato Botelho
|
$retval = 1;
|
582 |
8f8682f7
|
Phil Davis
|
}
|
583 |
565488c9
|
Renato Botelho
|
$savemsg = get_std_save_message($retval);
|
584 |
5b237745
|
Scott Ullrich
|
}
|
585 |
|
|
|
586 |
cba980f6
|
jim-p
|
if ($act == "delpool") {
|
587 |
|
|
if ($a_pools[$_GET['id']]) {
|
588 |
|
|
unset($a_pools[$_GET['id']]);
|
589 |
|
|
write_config();
|
590 |
|
|
header("Location: services_dhcp.php?if={$if}");
|
591 |
|
|
exit;
|
592 |
|
|
}
|
593 |
|
|
}
|
594 |
|
|
|
595 |
|
|
if ($act == "del") {
|
596 |
5b237745
|
Scott Ullrich
|
if ($a_maps[$_GET['id']]) {
|
597 |
|
|
unset($a_maps[$_GET['id']]);
|
598 |
|
|
write_config();
|
599 |
8f8682f7
|
Phil Davis
|
if (isset($config['dhcpd'][$if]['enable'])) {
|
600 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('staticmaps');
|
601 |
8f8682f7
|
Phil Davis
|
if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic'])) {
|
602 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('hosts');
|
603 |
8f8682f7
|
Phil Davis
|
}
|
604 |
6a01ea44
|
Bill Marquette
|
}
|
605 |
5b237745
|
Scott Ullrich
|
header("Location: services_dhcp.php?if={$if}");
|
606 |
|
|
exit;
|
607 |
|
|
}
|
608 |
|
|
}
|
609 |
4df96eff
|
Scott Ullrich
|
|
610 |
180db186
|
Colin Fleming
|
$closehead = false;
|
611 |
8f8682f7
|
Phil Davis
|
$pgtitle = array(gettext("Services"), gettext("DHCP server"));
|
612 |
b32dd0a6
|
jim-p
|
$shortcut_section = "dhcp";
|
613 |
5224b8e7
|
jim-p
|
|
614 |
4df96eff
|
Scott Ullrich
|
include("head.inc");
|
615 |
|
|
|
616 |
5b237745
|
Scott Ullrich
|
?>
|
617 |
4df96eff
|
Scott Ullrich
|
|
618 |
518030b3
|
Scott Ullrich
|
<script type="text/javascript" src="/javascript/row_helper.js">
|
619 |
|
|
</script>
|
620 |
4e9cd828
|
Seth Mos
|
|
621 |
518030b3
|
Scott Ullrich
|
<script type="text/javascript">
|
622 |
180db186
|
Colin Fleming
|
//<![CDATA[
|
623 |
678dfd0f
|
Erik Fonnesbeck
|
function itemtype_field(fieldname, fieldsize, n) {
|
624 |
|
|
return '<select name="' + fieldname + n + '" class="formselect" id="' + fieldname + n + '"><?php
|
625 |
1452fa57
|
Erik Fonnesbeck
|
$customitemtypes = array('text' => gettext('Text'), 'string' => gettext('String'), 'boolean' => gettext('Boolean'),
|
626 |
|
|
'unsigned integer 8' => gettext('Unsigned 8-bit integer'), 'unsigned integer 16' => gettext('Unsigned 16-bit integer'), 'unsigned integer 32' => gettext('Unsigned 32-bit integer'),
|
627 |
|
|
'signed integer 8' => gettext('Signed 8-bit integer'), 'signed integer 16' => gettext('Signed 16-bit integer'), 'signed integer 32' => gettext('Signed 32-bit integer'), 'ip-address' => gettext('IP address or host'));
|
628 |
678dfd0f
|
Erik Fonnesbeck
|
foreach ($customitemtypes as $typename => $typedescr) {
|
629 |
180db186
|
Colin Fleming
|
echo "<option value=\"{$typename}\">{$typedescr}<\/option>";
|
630 |
678dfd0f
|
Erik Fonnesbeck
|
}
|
631 |
180db186
|
Colin Fleming
|
?><\/select>';
|
632 |
678dfd0f
|
Erik Fonnesbeck
|
}
|
633 |
|
|
|
634 |
518030b3
|
Scott Ullrich
|
rowname[0] = "number";
|
635 |
|
|
rowtype[0] = "textbox";
|
636 |
4e10cf0a
|
Scott Ullrich
|
rowsize[0] = "10";
|
637 |
678dfd0f
|
Erik Fonnesbeck
|
rowname[1] = "itemtype";
|
638 |
|
|
rowtype[1] = itemtype_field;
|
639 |
|
|
rowname[2] = "value";
|
640 |
|
|
rowtype[2] = "textbox";
|
641 |
|
|
rowsize[2] = "40";
|
642 |
180db186
|
Colin Fleming
|
//]]>
|
643 |
518030b3
|
Scott Ullrich
|
</script>
|
644 |
4e9cd828
|
Seth Mos
|
|
645 |
91f026b0
|
ayvis
|
<script type="text/javascript">
|
646 |
180db186
|
Colin Fleming
|
//<![CDATA[
|
647 |
518030b3
|
Scott Ullrich
|
function enable_change(enable_over) {
|
648 |
|
|
var endis;
|
649 |
cba980f6
|
jim-p
|
<?php if (is_numeric($pool) || ($act == "newpool")): ?>
|
650 |
|
|
enable_over = true;
|
651 |
|
|
<?php endif; ?>
|
652 |
518030b3
|
Scott Ullrich
|
endis = !(document.iform.enable.checked || enable_over);
|
653 |
ee1fb205
|
jim-p
|
<?php if (is_numeric($pool) || ($act == "newpool")): ?>
|
654 |
|
|
document.iform.descr.disabled = endis;
|
655 |
|
|
<?php endif; ?>
|
656 |
518030b3
|
Scott Ullrich
|
document.iform.range_from.disabled = endis;
|
657 |
|
|
document.iform.range_to.disabled = endis;
|
658 |
|
|
document.iform.wins1.disabled = endis;
|
659 |
|
|
document.iform.wins2.disabled = endis;
|
660 |
|
|
document.iform.dns1.disabled = endis;
|
661 |
|
|
document.iform.dns2.disabled = endis;
|
662 |
3b5707db
|
Phil Davis
|
document.iform.dns3.disabled = endis;
|
663 |
|
|
document.iform.dns4.disabled = endis;
|
664 |
518030b3
|
Scott Ullrich
|
document.iform.deftime.disabled = endis;
|
665 |
|
|
document.iform.maxtime.disabled = endis;
|
666 |
|
|
document.iform.gateway.disabled = endis;
|
667 |
|
|
document.iform.failover_peerip.disabled = endis;
|
668 |
|
|
document.iform.domain.disabled = endis;
|
669 |
|
|
document.iform.domainsearchlist.disabled = endis;
|
670 |
|
|
document.iform.staticarp.disabled = endis;
|
671 |
f365fa90
|
Joecowboy
|
document.iform.dhcpleaseinlocaltime.disabled = endis;
|
672 |
518030b3
|
Scott Ullrich
|
document.iform.ddnsdomain.disabled = endis;
|
673 |
87019fc4
|
Andres Petralli
|
document.iform.ddnsdomainprimary.disabled = endis;
|
674 |
|
|
document.iform.ddnsdomainkeyname.disabled = endis;
|
675 |
|
|
document.iform.ddnsdomainkey.disabled = endis;
|
676 |
518030b3
|
Scott Ullrich
|
document.iform.ddnsupdate.disabled = endis;
|
677 |
1f1a08c8
|
jim-p
|
document.iform.mac_allow.disabled = endis;
|
678 |
|
|
document.iform.mac_deny.disabled = endis;
|
679 |
518030b3
|
Scott Ullrich
|
document.iform.ntp1.disabled = endis;
|
680 |
|
|
document.iform.ntp2.disabled = endis;
|
681 |
|
|
document.iform.tftp.disabled = endis;
|
682 |
|
|
document.iform.ldap.disabled = endis;
|
683 |
|
|
document.iform.netboot.disabled = endis;
|
684 |
|
|
document.iform.nextserver.disabled = endis;
|
685 |
|
|
document.iform.filename.disabled = endis;
|
686 |
7023c602
|
Charlie Root
|
document.iform.filename32.disabled = endis;
|
687 |
|
|
document.iform.filename64.disabled = endis;
|
688 |
518030b3
|
Scott Ullrich
|
document.iform.rootpath.disabled = endis;
|
689 |
|
|
document.iform.denyunknown.disabled = endis;
|
690 |
|
|
}
|
691 |
4e9cd828
|
Seth Mos
|
|
692 |
b1d132f5
|
Scott Ullrich
|
function show_shownumbervalue() {
|
693 |
|
|
document.getElementById("shownumbervaluebox").innerHTML='';
|
694 |
|
|
aodiv = document.getElementById('shownumbervalue');
|
695 |
|
|
aodiv.style.display = "block";
|
696 |
|
|
}
|
697 |
|
|
|
698 |
518030b3
|
Scott Ullrich
|
function show_ddns_config() {
|
699 |
|
|
document.getElementById("showddnsbox").innerHTML='';
|
700 |
|
|
aodiv = document.getElementById('showddns');
|
701 |
|
|
aodiv.style.display = "block";
|
702 |
|
|
}
|
703 |
ad171999
|
Seth Mos
|
|
704 |
1f1a08c8
|
jim-p
|
function show_maccontrol_config() {
|
705 |
|
|
document.getElementById("showmaccontrolbox").innerHTML='';
|
706 |
|
|
aodiv = document.getElementById('showmaccontrol');
|
707 |
|
|
aodiv.style.display = "block";
|
708 |
|
|
}
|
709 |
|
|
|
710 |
518030b3
|
Scott Ullrich
|
function show_ntp_config() {
|
711 |
|
|
document.getElementById("showntpbox").innerHTML='';
|
712 |
|
|
aodiv = document.getElementById('showntp');
|
713 |
|
|
aodiv.style.display = "block";
|
714 |
|
|
}
|
715 |
6c23757b
|
Martin Fuchs
|
|
716 |
518030b3
|
Scott Ullrich
|
function show_tftp_config() {
|
717 |
|
|
document.getElementById("showtftpbox").innerHTML='';
|
718 |
|
|
aodiv = document.getElementById('showtftp');
|
719 |
|
|
aodiv.style.display = "block";
|
720 |
|
|
}
|
721 |
6c23757b
|
Martin Fuchs
|
|
722 |
518030b3
|
Scott Ullrich
|
function show_ldap_config() {
|
723 |
|
|
document.getElementById("showldapbox").innerHTML='';
|
724 |
|
|
aodiv = document.getElementById('showldap');
|
725 |
|
|
aodiv.style.display = "block";
|
726 |
|
|
}
|
727 |
4e9cd828
|
Seth Mos
|
|
728 |
518030b3
|
Scott Ullrich
|
function show_netboot_config() {
|
729 |
|
|
document.getElementById("shownetbootbox").innerHTML='';
|
730 |
|
|
aodiv = document.getElementById('shownetboot');
|
731 |
|
|
aodiv.style.display = "block";
|
732 |
|
|
}
|
733 |
180db186
|
Colin Fleming
|
//]]>
|
734 |
5b237745
|
Scott Ullrich
|
</script>
|
735 |
180db186
|
Colin Fleming
|
</head>
|
736 |
5b237745
|
Scott Ullrich
|
|
737 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
738 |
b7597d4e
|
Bill Marquette
|
<?php include("fbegin.inc"); ?>
|
739 |
5b237745
|
Scott Ullrich
|
<form action="services_dhcp.php" method="post" name="iform" id="iform">
|
740 |
|
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
741 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
742 |
de792e62
|
jim-p
|
<?php
|
743 |
0a35ca7c
|
jim-p
|
if (isset($config['dhcrelay']['enable'])) {
|
744 |
40ad67e0
|
Rafael Lucas
|
echo gettext("DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.");
|
745 |
de792e62
|
jim-p
|
include("fend.inc");
|
746 |
3d7b7757
|
Chris Buechler
|
echo "</body>";
|
747 |
|
|
echo "</html>";
|
748 |
|
|
exit;
|
749 |
|
|
}
|
750 |
|
|
?>
|
751 |
180db186
|
Colin Fleming
|
<?php if (is_subsystem_dirty('staticmaps')): ?><br/>
|
752 |
8cd558b6
|
ayvis
|
<?php print_info_box_np(gettext("The static mapping configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
|
753 |
5b237745
|
Scott Ullrich
|
<?php endif; ?>
|
754 |
180db186
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="dhcp server">
|
755 |
8f8682f7
|
Phil Davis
|
<tr>
|
756 |
|
|
<td>
|
757 |
de792e62
|
jim-p
|
<?php
|
758 |
f0cdf141
|
Scott Ullrich
|
/* active tabs */
|
759 |
|
|
$tab_array = array();
|
760 |
|
|
$tabscounter = 0;
|
761 |
|
|
$i = 0;
|
762 |
|
|
foreach ($iflist as $ifent => $ifname) {
|
763 |
de792e62
|
jim-p
|
$oc = $config['interfaces'][$ifent];
|
764 |
e5770bc2
|
Bill Marquette
|
if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddrv4($oc['ipaddr']))) ||
|
765 |
8f8682f7
|
Phil Davis
|
(!is_array($config['dhcpd'][$ifent]) && (!is_ipaddrv4($oc['ipaddr'])))) {
|
766 |
934240ef
|
Ermal Luçi
|
continue;
|
767 |
8f8682f7
|
Phil Davis
|
}
|
768 |
|
|
if ($ifent == $if) {
|
769 |
f0cdf141
|
Scott Ullrich
|
$active = true;
|
770 |
8f8682f7
|
Phil Davis
|
} else {
|
771 |
f0cdf141
|
Scott Ullrich
|
$active = false;
|
772 |
8f8682f7
|
Phil Davis
|
}
|
773 |
f0cdf141
|
Scott Ullrich
|
$tab_array[] = array($ifname, $active, "services_dhcp.php?if={$ifent}");
|
774 |
934240ef
|
Ermal Luçi
|
$tabscounter++;
|
775 |
|
|
}
|
776 |
|
|
if ($tabscounter == 0) {
|
777 |
4e82cebf
|
Chris Buechler
|
echo "<b>" . gettext("The DHCP Server can only be enabled on interfaces configured with a static IPv4 address. This system has none.") . "<br/><br/>";
|
778 |
934240ef
|
Ermal Luçi
|
echo "</td></tr></table></form>";
|
779 |
|
|
include("fend.inc");
|
780 |
|
|
echo "</body>";
|
781 |
|
|
echo "</html>";
|
782 |
|
|
exit;
|
783 |
f0cdf141
|
Scott Ullrich
|
}
|
784 |
|
|
display_top_tabs($tab_array);
|
785 |
de792e62
|
jim-p
|
?>
|
786 |
8f8682f7
|
Phil Davis
|
</td>
|
787 |
|
|
</tr>
|
788 |
|
|
<tr>
|
789 |
|
|
<td>
|
790 |
|
|
<div id="mainarea">
|
791 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
|
792 |
cba980f6
|
jim-p
|
<?php if (!is_numeric($pool) && !($act == "newpool")): ?>
|
793 |
8f8682f7
|
Phil Davis
|
<tr>
|
794 |
|
|
<td width="22%" valign="top" class="vtable"> </td>
|
795 |
|
|
<td width="78%" class="vtable">
|
796 |
|
|
<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onclick="enable_change(false)" />
|
797 |
|
|
<strong><?php printf(gettext("Enable DHCP server on %s interface"), htmlspecialchars($iflist[$if]));?></strong>
|
798 |
|
|
</td>
|
799 |
|
|
</tr>
|
800 |
cba980f6
|
jim-p
|
<?php else: ?>
|
801 |
ee1fb205
|
jim-p
|
<tr>
|
802 |
8f8682f7
|
Phil Davis
|
<td colspan="2" class="listtopic"><?php echo gettext("Editing Pool-Specific Options. To return to the Interface, click its tab above."); ?></td>
|
803 |
ee1fb205
|
jim-p
|
</tr>
|
804 |
|
|
<?php endif; ?>
|
805 |
8f8682f7
|
Phil Davis
|
<tr>
|
806 |
|
|
<td width="22%" valign="top" class="vtable"> </td>
|
807 |
|
|
<td width="78%" class="vtable">
|
808 |
|
|
<input name="denyunknown" id="denyunknown" type="checkbox" value="yes" <?php if ($pconfig['denyunknown']) echo "checked=\"checked\""; ?> />
|
809 |
|
|
<strong><?=gettext("Deny unknown clients");?></strong><br />
|
810 |
|
|
<?=gettext("If this is checked, only the clients defined below will get DHCP leases from this server. ");?>
|
811 |
|
|
</td>
|
812 |
|
|
</tr>
|
813 |
cba980f6
|
jim-p
|
<?php if (is_numeric($pool) || ($act == "newpool")): ?>
|
814 |
8f8682f7
|
Phil Davis
|
<tr>
|
815 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Pool Description");?></td>
|
816 |
|
|
<td width="78%" class="vtable">
|
817 |
|
|
<input name="descr" type="text" class="formfld unknown" id="descr" size="20" value="<?=htmlspecialchars($pconfig['descr']);?>" />
|
818 |
|
|
</td>
|
819 |
|
|
</tr>
|
820 |
de792e62
|
jim-p
|
<?php endif; ?>
|
821 |
cba980f6
|
jim-p
|
<tr>
|
822 |
8f8682f7
|
Phil Davis
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet");?></td>
|
823 |
|
|
<td width="78%" class="vtable">
|
824 |
|
|
<?=gen_subnet($ifcfgip, $ifcfgsn);?>
|
825 |
cba980f6
|
jim-p
|
</td>
|
826 |
|
|
</tr>
|
827 |
|
|
<tr>
|
828 |
8f8682f7
|
Phil Davis
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet mask");?></td>
|
829 |
|
|
<td width="78%" class="vtable">
|
830 |
|
|
<?=gen_subnet_mask($ifcfgsn);?>
|
831 |
|
|
</td>
|
832 |
cba980f6
|
jim-p
|
</tr>
|
833 |
|
|
<tr>
|
834 |
8f8682f7
|
Phil Davis
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Available range");?></td>
|
835 |
|
|
<td width="78%" class="vtable">
|
836 |
|
|
<?php
|
837 |
|
|
$range_from = ip2long(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
|
838 |
|
|
$range_from++;
|
839 |
|
|
echo long2ip32($range_from);
|
840 |
|
|
?>
|
841 |
|
|
-
|
842 |
|
|
<?php
|
843 |
|
|
$range_to = ip2long(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
|
844 |
|
|
$range_to--;
|
845 |
|
|
echo long2ip32($range_to);
|
846 |
|
|
if (is_numeric($pool) || ($act == "newpool")):
|
847 |
|
|
?>
|
848 |
|
|
<br />In-use DHCP Pool Ranges:
|
849 |
|
|
<?php
|
850 |
|
|
if (is_array($config['dhcpd'][$if]['range'])):
|
851 |
|
|
?>
|
852 |
|
|
<br />
|
853 |
|
|
<?php
|
854 |
|
|
echo $config['dhcpd'][$if]['range']['from'];
|
855 |
|
|
?>
|
856 |
|
|
-
|
857 |
|
|
<?php
|
858 |
|
|
echo $config['dhcpd'][$if]['range']['to'];
|
859 |
|
|
endif;
|
860 |
|
|
?>
|
861 |
|
|
<?php
|
862 |
|
|
foreach ($a_pools as $p):
|
863 |
|
|
if (is_array($p['range'])):
|
864 |
|
|
?>
|
865 |
|
|
<br />
|
866 |
|
|
<?php
|
867 |
|
|
echo $p['range']['from'];
|
868 |
|
|
?>
|
869 |
|
|
-
|
870 |
|
|
<?php
|
871 |
|
|
echo $p['range']['to'];
|
872 |
|
|
endif;
|
873 |
|
|
endforeach;
|
874 |
|
|
endif;
|
875 |
|
|
?>
|
876 |
|
|
</td>
|
877 |
cba980f6
|
jim-p
|
</tr>
|
878 |
8f8682f7
|
Phil Davis
|
<?php if ($is_olsr_enabled): ?>
|
879 |
|
|
<tr>
|
880 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet Mask");?></td>
|
881 |
|
|
<td width="78%" class="vtable">
|
882 |
|
|
<select name="netmask" class="formselect" id="netmask">
|
883 |
|
|
<?php
|
884 |
|
|
for ($i = 32; $i > 0; $i--) {
|
885 |
|
|
if ($i <> 31) {
|
886 |
|
|
echo "<option value=\"{$i}\" ";
|
887 |
|
|
if ($i == $pconfig['netmask']) {
|
888 |
|
|
echo "selected=\"selected\"";
|
889 |
|
|
}
|
890 |
|
|
echo ">" . $i . "</option>";
|
891 |
|
|
}
|
892 |
|
|
}
|
893 |
|
|
?>
|
894 |
|
|
</select>
|
895 |
de792e62
|
jim-p
|
</td>
|
896 |
8f8682f7
|
Phil Davis
|
</tr>
|
897 |
|
|
<?php endif; ?>
|
898 |
|
|
<tr>
|
899 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Range");?></td>
|
900 |
|
|
<td width="78%" class="vtable">
|
901 |
|
|
<input name="range_from" type="text" class="formfld unknown" id="range_from" size="20" value="<?=htmlspecialchars($pconfig['range_from']);?>" />
|
902 |
|
|
<?=gettext("to"); ?> <input name="range_to" type="text" class="formfld unknown" id="range_to" size="20" value="<?=htmlspecialchars($pconfig['range_to']);?>" />
|
903 |
de792e62
|
jim-p
|
</td>
|
904 |
8f8682f7
|
Phil Davis
|
</tr>
|
905 |
|
|
<?php
|
906 |
|
|
if (!is_numeric($pool) && !($act == "newpool")):
|
907 |
|
|
?>
|
908 |
|
|
<tr>
|
909 |
|
|
<td width="22%" valign="top" class="vncell">
|
910 |
|
|
<?=gettext("Additional Pools");?>
|
911 |
6215694a
|
Joecowboy
|
</td>
|
912 |
8f8682f7
|
Phil Davis
|
<td width="78%" class="vtable">
|
913 |
|
|
<?php echo gettext("If you need additional pools of addresses inside of this subnet outside the above Range, they may be specified here."); ?>
|
914 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="subnet">
|
915 |
|
|
<tr>
|
916 |
|
|
<td width="35%" class="listhdrr"><?=gettext("Pool Start");?></td>
|
917 |
|
|
<td width="35%" class="listhdrr"><?=gettext("Pool End");?></td>
|
918 |
|
|
<td width="20%" class="listhdrr"><?=gettext("Description");?></td>
|
919 |
|
|
<td width="10%" class="list">
|
920 |
|
|
<table border="0" cellspacing="0" cellpadding="1" summary="pool">
|
921 |
|
|
<tr>
|
922 |
|
|
<td valign="middle" width="17"></td>
|
923 |
|
|
<td valign="middle">
|
924 |
|
|
<a href="services_dhcp.php?if=<?=htmlspecialchars($if);?>&act=newpool"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="plus" /></a>
|
925 |
|
|
</td>
|
926 |
|
|
</tr>
|
927 |
|
|
</table>
|
928 |
|
|
</td>
|
929 |
|
|
</tr>
|
930 |
|
|
<?php
|
931 |
|
|
if (is_array($a_pools)):
|
932 |
|
|
$i = 0;
|
933 |
|
|
foreach ($a_pools as $poolent):
|
934 |
|
|
if (!empty($poolent['range']['from']) && !empty($poolent['range']['to'])):
|
935 |
|
|
?>
|
936 |
|
|
<tr>
|
937 |
|
|
<td class="listlr" ondblclick="document.location='services_dhcp.php?if=<?=htmlspecialchars($if);?>&pool=<?=$i;?>';">
|
938 |
|
|
<?=htmlspecialchars($poolent['range']['from']);?>
|
939 |
|
|
</td>
|
940 |
|
|
<td class="listr" ondblclick="document.location='services_dhcp.php?if=<?=htmlspecialchars($if);?>&pool=<?=$i;?>';">
|
941 |
|
|
<?=htmlspecialchars($poolent['range']['to']);?>
|
942 |
|
|
</td>
|
943 |
|
|
<td class="listr" ondblclick="document.location='services_dhcp.php?if=<?=htmlspecialchars($if);?>&pool=<?=$i;?>';">
|
944 |
|
|
<?=htmlspecialchars($poolent['descr']);?>
|
945 |
|
|
</td>
|
946 |
|
|
<td valign="middle" class="list nowrap">
|
947 |
|
|
<table border="0" cellspacing="0" cellpadding="1" summary="icons">
|
948 |
|
|
<tr>
|
949 |
|
|
<td valign="middle">
|
950 |
|
|
<a href="services_dhcp.php?if=<?=htmlspecialchars($if);?>&pool=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a>
|
951 |
|
|
</td>
|
952 |
|
|
<td valign="middle">
|
953 |
|
|
<a href="services_dhcp.php?if=<?=htmlspecialchars($if);?>&act=delpool&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this pool?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a>
|
954 |
|
|
</td>
|
955 |
|
|
</tr>
|
956 |
|
|
</table>
|
957 |
|
|
</td>
|
958 |
|
|
</tr>
|
959 |
|
|
<?php
|
960 |
|
|
endif;
|
961 |
|
|
$i++;
|
962 |
|
|
endforeach;
|
963 |
|
|
endif;
|
964 |
|
|
?>
|
965 |
|
|
<tr>
|
966 |
|
|
<td class="list" colspan="3"></td>
|
967 |
|
|
<td class="list">
|
968 |
|
|
<table border="0" cellspacing="0" cellpadding="1" summary="add">
|
969 |
|
|
<tr>
|
970 |
|
|
<td valign="middle" width="17"></td>
|
971 |
|
|
<td valign="middle">
|
972 |
|
|
<a href="services_dhcp.php?if=<?=htmlspecialchars($if);?>&act=newpool"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a>
|
973 |
|
|
</td>
|
974 |
|
|
</tr>
|
975 |
|
|
</table>
|
976 |
|
|
</td>
|
977 |
|
|
</tr>
|
978 |
|
|
</table>
|
979 |
6215694a
|
Joecowboy
|
</td>
|
980 |
8f8682f7
|
Phil Davis
|
</tr>
|
981 |
|
|
<?php
|
982 |
|
|
endif;
|
983 |
|
|
?>
|
984 |
|
|
<tr>
|
985 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("WINS servers");?></td>
|
986 |
|
|
<td width="78%" class="vtable">
|
987 |
|
|
<input name="wins1" type="text" class="formfld unknown" id="wins1" size="20" value="<?=htmlspecialchars($pconfig['wins1']);?>" /><br />
|
988 |
|
|
<input name="wins2" type="text" class="formfld unknown" id="wins2" size="20" value="<?=htmlspecialchars($pconfig['wins2']);?>" />
|
989 |
6215694a
|
Joecowboy
|
</td>
|
990 |
8f8682f7
|
Phil Davis
|
</tr>
|
991 |
|
|
<tr>
|
992 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("DNS servers");?></td>
|
993 |
|
|
<td width="78%" class="vtable">
|
994 |
|
|
<input name="dns1" type="text" class="formfld unknown" id="dns1" size="20" value="<?=htmlspecialchars($pconfig['dns1']);?>" /><br />
|
995 |
|
|
<input name="dns2" type="text" class="formfld unknown" id="dns2" size="20" value="<?=htmlspecialchars($pconfig['dns2']);?>" /><br />
|
996 |
|
|
<input name="dns3" type="text" class="formfld unknown" id="dns3" size="20" value="<?=htmlspecialchars($pconfig['dns3']);?>" /><br />
|
997 |
|
|
<input name="dns4" type="text" class="formfld unknown" id="dns4" size="20" value="<?=htmlspecialchars($pconfig['dns4']);?>" /><br />
|
998 |
75eef6ca
|
Chris Buechler
|
<?=gettext("NOTE: leave blank to use the system default DNS servers - this interface's IP if DNS Forwarder or Resolver is enabled, otherwise the servers configured on the General page.");?>
|
999 |
8f8682f7
|
Phil Davis
|
</td>
|
1000 |
|
|
</tr>
|
1001 |
|
|
<tr>
|
1002 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Gateway");?></td>
|
1003 |
|
|
<td width="78%" class="vtable">
|
1004 |
|
|
<input name="gateway" type="text" class="formfld host" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>" /><br />
|
1005 |
|
|
<?=gettext("The default is to use the IP on this interface of the firewall as the gateway. Specify an alternate gateway here if this is not the correct gateway for your network. Type \"none\" for no gateway assignment.");?>
|
1006 |
|
|
</td>
|
1007 |
|
|
</tr>
|
1008 |
|
|
<tr>
|
1009 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Domain name");?></td>
|
1010 |
|
|
<td width="78%" class="vtable">
|
1011 |
|
|
<input name="domain" type="text" class="formfld unknown" id="domain" size="20" value="<?=htmlspecialchars($pconfig['domain']);?>" /><br />
|
1012 |
|
|
<?=gettext("The default is to use the domain name of this system as the default domain name provided by DHCP. You may specify an alternate domain name here.");?>
|
1013 |
|
|
</td>
|
1014 |
|
|
</tr>
|
1015 |
|
|
<tr>
|
1016 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Domain search list");?></td>
|
1017 |
|
|
<td width="78%" class="vtable">
|
1018 |
|
|
<input name="domainsearchlist" type="text" class="formfld unknown" id="domainsearchlist" size="20" value="<?=htmlspecialchars($pconfig['domainsearchlist']);?>" /><br />
|
1019 |
|
|
<?=gettext("The DHCP server can optionally provide a domain search list. Use the semicolon character as separator ");?>
|
1020 |
|
|
</td>
|
1021 |
|
|
</tr>
|
1022 |
|
|
<tr>
|
1023 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Default lease time");?></td>
|
1024 |
|
|
<td width="78%" class="vtable">
|
1025 |
|
|
<input name="deftime" type="text" class="formfld unknown" id="deftime" size="10" value="<?=htmlspecialchars($pconfig['deftime']);?>" />
|
1026 |
|
|
<?=gettext("seconds");?><br />
|
1027 |
|
|
<?=gettext("This is used for clients that do not ask for a specific expiration time."); ?><br />
|
1028 |
|
|
<?=gettext("The default is 7200 seconds.");?>
|
1029 |
|
|
</td>
|
1030 |
|
|
</tr>
|
1031 |
|
|
<tr>
|
1032 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Maximum lease time");?></td>
|
1033 |
|
|
<td width="78%" class="vtable">
|
1034 |
|
|
<input name="maxtime" type="text" class="formfld unknown" id="maxtime" size="10" value="<?=htmlspecialchars($pconfig['maxtime']);?>" />
|
1035 |
|
|
<?=gettext("seconds");?><br />
|
1036 |
|
|
<?=gettext("This is the maximum lease time for clients that ask for a specific expiration time."); ?><br />
|
1037 |
|
|
<?=gettext("The default is 86400 seconds.");?>
|
1038 |
|
|
</td>
|
1039 |
|
|
</tr>
|
1040 |
|
|
<?php
|
1041 |
|
|
if (!is_numeric($pool) && !($act == "newpool")):
|
1042 |
|
|
?>
|
1043 |
|
|
<tr>
|
1044 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Failover peer IP:");?></td>
|
1045 |
|
|
<td width="78%" class="vtable">
|
1046 |
|
|
<input name="failover_peerip" type="text" class="formfld host" id="failover_peerip" size="20" value="<?=htmlspecialchars($pconfig['failover_peerip']);?>" /><br />
|
1047 |
|
|
<?=gettext("Leave blank to disable. Enter the interface IP address of the other machine. Machines must be using CARP. Interface's advskew determines whether the DHCPd process is Primary or Secondary. Ensure one machine's advskew<20 (and the other is >20).");?>
|
1048 |
|
|
</td>
|
1049 |
|
|
</tr>
|
1050 |
|
|
<?php
|
1051 |
|
|
endif;
|
1052 |
|
|
|
1053 |
|
|
if (!is_numeric($pool) && !($act == "newpool")):
|
1054 |
|
|
?>
|
1055 |
|
|
<tr>
|
1056 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Static ARP");?></td>
|
1057 |
|
|
<td width="78%" class="vtable">
|
1058 |
|
|
<table summary="static arp">
|
1059 |
|
|
<tr>
|
1060 |
|
|
<td>
|
1061 |
|
|
<input style="vertical-align:middle" type="checkbox" value="yes" name="staticarp" id="staticarp" <?php if ($pconfig['staticarp']) echo " checked=\"checked\""; ?> />
|
1062 |
|
|
</td>
|
1063 |
|
|
<td><b><?=gettext("Enable Static ARP entries");?></b></td>
|
1064 |
|
|
</tr>
|
1065 |
|
|
<tr>
|
1066 |
|
|
<td> </td>
|
1067 |
|
|
<td>
|
1068 |
|
|
<span class="red">
|
1069 |
|
|
<strong><?=gettext("Note:");?></strong>
|
1070 |
|
|
</span>
|
1071 |
|
|
<?=gettext("This option persists even if DHCP server is disabled. Only the machines listed below will be able to communicate with the firewall on this NIC.");?>
|
1072 |
|
|
</td>
|
1073 |
|
|
</tr>
|
1074 |
|
|
</table>
|
1075 |
|
|
</td>
|
1076 |
|
|
</tr>
|
1077 |
|
|
<?php
|
1078 |
|
|
endif;
|
1079 |
|
|
|
1080 |
|
|
if (!is_numeric($pool) && !($act == "newpool")): ?>
|
1081 |
|
|
<tr>
|
1082 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Time format change"); ?></td>
|
1083 |
|
|
<td width="78%" class="vtable">
|
1084 |
|
|
<table summary="time format">
|
1085 |
|
|
<tr>
|
1086 |
|
|
<td>
|
1087 |
|
|
<input name="dhcpleaseinlocaltime" type="checkbox" id="dhcpleaseinlocaltime" value="yes" <?php if ($pconfig['dhcpleaseinlocaltime']) echo "checked=\"checked\""; ?> />
|
1088 |
|
|
</td>
|
1089 |
|
|
<td>
|
1090 |
|
|
<strong>
|
1091 |
|
|
<?=gettext("Change DHCP display lease time from UTC to local time."); ?>
|
1092 |
|
|
</strong>
|
1093 |
|
|
</td>
|
1094 |
|
|
</tr>
|
1095 |
|
|
<tr>
|
1096 |
|
|
<td> </td>
|
1097 |
|
|
<td>
|
1098 |
|
|
<span class="red">
|
1099 |
|
|
<strong><?=gettext("Note:");?></strong>
|
1100 |
|
|
</span>
|
1101 |
|
|
<?=gettext("By default DHCP leases are displayed in UTC time. By checking this box DHCP lease time will be displayed in local time and set to time zone selected. This will be used for all DHCP interfaces lease time."); ?>
|
1102 |
|
|
</td>
|
1103 |
|
|
</tr>
|
1104 |
|
|
</table>
|
1105 |
|
|
</td>
|
1106 |
|
|
</tr>
|
1107 |
|
|
<?php
|
1108 |
|
|
endif;
|
1109 |
|
|
?>
|
1110 |
|
|
<tr>
|
1111 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Dynamic DNS");?></td>
|
1112 |
|
|
<td width="78%" class="vtable">
|
1113 |
90ad3a76
|
Phil Davis
|
<div id="showddnsbox" <?php if ($pconfig['ddnsupdate'] || !empty($pconfig['ddnsdomain']) || !empty($pconfig['ddnsdomainprimary']) || !empty($pconfig['ddnsdomainkeyname']) || !empty($pconfig['ddnsdomainkey'])) echo "style='display:none'"; ?>>
|
1114 |
8f8682f7
|
Phil Davis
|
<input type="button" onclick="show_ddns_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Dynamic DNS");?>
|
1115 |
|
|
</div>
|
1116 |
90ad3a76
|
Phil Davis
|
<div id="showddns" <?php if (!$pconfig['ddnsupdate'] && empty($pconfig['ddnsdomain']) && empty($pconfig['ddnsdomainprimary']) && empty($pconfig['ddnsdomainkeyname']) && empty($pconfig['ddnsdomainkey'])) echo "style='display:none'"; ?>>
|
1117 |
8f8682f7
|
Phil Davis
|
<input style="vertical-align:middle" type="checkbox" value="yes" name="ddnsupdate" id="ddnsupdate" <?php if ($pconfig['ddnsupdate']) echo " checked=\"checked\""; ?> />
|
1118 |
|
|
<b><?=gettext("Enable registration of DHCP client names in DNS.");?></b><br />
|
1119 |
|
|
<br/>
|
1120 |
|
|
<input name="ddnsdomain" type="text" class="formfld unknown" id="ddnsdomain" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomain']);?>" /><br />
|
1121 |
|
|
<?=gettext("Note: Leave blank to disable dynamic DNS registration.");?><br />
|
1122 |
|
|
<?=gettext("Enter the dynamic DNS domain which will be used to register client names in the DNS server.");?><br />
|
1123 |
|
|
<input name="ddnsdomainprimary" type="text" class="formfld unknown" id="ddnsdomainprimary" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainprimary']);?>" /><br />
|
1124 |
|
|
<?=gettext("Enter the primary domain name server IP address for the dynamic domain name.");?><br />
|
1125 |
|
|
<input name="ddnsdomainkeyname" type="text" class="formfld unknown" id="ddnsdomainkeyname" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainkeyname']);?>" /><br />
|
1126 |
|
|
<?=gettext("Enter the dynamic DNS domain key name which will be used to register client names in the DNS server.");?><br />
|
1127 |
|
|
<input name="ddnsdomainkey" type="text" class="formfld unknown" id="ddnsdomainkey" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomainkey']);?>" /><br />
|
1128 |
|
|
<?=gettext("Enter the dynamic DNS domain key secret which will be used to register client names in the DNS server.");?>
|
1129 |
|
|
</div>
|
1130 |
|
|
</td>
|
1131 |
|
|
</tr>
|
1132 |
|
|
<tr>
|
1133 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("MAC Address Control");?></td>
|
1134 |
|
|
<td width="78%" class="vtable">
|
1135 |
90ad3a76
|
Phil Davis
|
<div id="showmaccontrolbox" <?php if (!empty($pconfig['mac_allow']) || !empty($pconfig['mac_deny'])) echo "style='display:none'"; ?>>
|
1136 |
8f8682f7
|
Phil Davis
|
<input type="button" onclick="show_maccontrol_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show MAC Address Control");?>
|
1137 |
|
|
</div>
|
1138 |
90ad3a76
|
Phil Davis
|
<div id="showmaccontrol" <?php if (empty($pconfig['mac_allow']) && empty($pconfig['mac_deny'])) echo "style='display:none'"; ?>>
|
1139 |
8f8682f7
|
Phil Davis
|
<input name="mac_allow" type="text" class="formfld unknown" id="mac_allow" size="20" value="<?=htmlspecialchars($pconfig['mac_allow']);?>" /><br />
|
1140 |
|
|
<?=gettext("Enter a list of partial MAC addresses to allow, comma separated, no spaces, such as ");?>00:00:00,01:E5:FF<br />
|
1141 |
|
|
<input name="mac_deny" type="text" class="formfld unknown" id="mac_deny" size="20" value="<?=htmlspecialchars($pconfig['mac_deny']);?>" /><br />
|
1142 |
|
|
<?=gettext("Enter a list of partial MAC addresses to deny access, comma separated, no spaces, such as ");?>00:00:00,01:E5:FF
|
1143 |
|
|
</div>
|
1144 |
|
|
</td>
|
1145 |
|
|
</tr>
|
1146 |
|
|
<tr>
|
1147 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("NTP servers");?></td>
|
1148 |
|
|
<td width="78%" class="vtable">
|
1149 |
90ad3a76
|
Phil Davis
|
<div id="showntpbox" <?php if (!empty($pconfig['ntp1']) || !empty($pconfig['ntp2'])) echo "style='display:none'"; ?>>
|
1150 |
8f8682f7
|
Phil Davis
|
<input type="button" onclick="show_ntp_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show NTP configuration");?>
|
1151 |
|
|
</div>
|
1152 |
90ad3a76
|
Phil Davis
|
<div id="showntp" <?php if (empty($pconfig['ntp1']) && empty($pconfig['ntp2'])) echo "style='display:none'"; ?>>
|
1153 |
8f8682f7
|
Phil Davis
|
<input name="ntp1" type="text" class="formfld unknown" id="ntp1" size="20" value="<?=htmlspecialchars($pconfig['ntp1']);?>" /><br />
|
1154 |
|
|
<input name="ntp2" type="text" class="formfld unknown" id="ntp2" size="20" value="<?=htmlspecialchars($pconfig['ntp2']);?>" />
|
1155 |
|
|
</div>
|
1156 |
|
|
</td>
|
1157 |
|
|
</tr>
|
1158 |
de792e62
|
jim-p
|
<tr>
|
1159 |
8f8682f7
|
Phil Davis
|
<td width="22%" valign="top" class="vncell"><?=gettext("TFTP server");?></td>
|
1160 |
|
|
<td width="78%" class="vtable">
|
1161 |
90ad3a76
|
Phil Davis
|
<div id="showtftpbox" <?php if (!empty($pconfig['tftp'])) echo "style='display:none'"; ?>>
|
1162 |
8f8682f7
|
Phil Davis
|
<input type="button" onclick="show_tftp_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show TFTP configuration");?>
|
1163 |
|
|
</div>
|
1164 |
90ad3a76
|
Phil Davis
|
<div id="showtftp" <?php if (empty($pconfig['tftp'])) echo "style='display:none'"; ?>>
|
1165 |
8f8682f7
|
Phil Davis
|
<input name="tftp" type="text" class="formfld unknown" id="tftp" size="50" value="<?=htmlspecialchars($pconfig['tftp']);?>" /><br />
|
1166 |
|
|
<?=gettext("Leave blank to disable. Enter a full hostname or IP for the TFTP server.");?>
|
1167 |
|
|
</div>
|
1168 |
|
|
</td>
|
1169 |
de792e62
|
jim-p
|
</tr>
|
1170 |
|
|
<tr>
|
1171 |
8f8682f7
|
Phil Davis
|
<td width="22%" valign="top" class="vncell"><?=gettext("LDAP URI");?></td>
|
1172 |
|
|
<td width="78%" class="vtable">
|
1173 |
90ad3a76
|
Phil Davis
|
<div id="showldapbox" <?php if (!empty($pconfig['ldap'])) echo "style='display:none'"; ?>>
|
1174 |
8f8682f7
|
Phil Davis
|
<input type="button" onclick="show_ldap_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show LDAP configuration");?>
|
1175 |
|
|
</div>
|
1176 |
90ad3a76
|
Phil Davis
|
<div id="showldap" <?php if (empty($pconfig['ldap'])) echo "style='display:none'"; ?>>
|
1177 |
8f8682f7
|
Phil Davis
|
<input name="ldap" type="text" class="formfld unknown" id="ldap" size="80" value="<?=htmlspecialchars($pconfig['ldap']);?>" /><br />
|
1178 |
|
|
<?=gettext("Leave blank to disable. Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com");?>
|
1179 |
|
|
</div>
|
1180 |
|
|
</td>
|
1181 |
de792e62
|
jim-p
|
</tr>
|
1182 |
|
|
<tr>
|
1183 |
8f8682f7
|
Phil Davis
|
<td width="22%" valign="top" class="vncell"><?=gettext("Enable network booting");?></td>
|
1184 |
|
|
<td width="78%" class="vtable">
|
1185 |
90ad3a76
|
Phil Davis
|
<div id="shownetbootbox" <?php if ($pconfig['netboot'] || !empty($pconfig['nextserver']) || !empty($pconfig['filename']) || !empty($pconfig['filename32']) || !empty($pconfig['filename64']) || !empty($pconfig['rootpath'])) echo "style='display:none'"; ?>>
|
1186 |
8f8682f7
|
Phil Davis
|
<input type="button" onclick="show_netboot_config()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Network booting");?>
|
1187 |
|
|
</div>
|
1188 |
90ad3a76
|
Phil Davis
|
<div id="shownetboot" <?php if (!$pconfig['netboot'] && empty($pconfig['nextserver']) && empty($pconfig['filename']) && empty($pconfig['filename32']) && empty($pconfig['filename64']) && empty($pconfig['rootpath'])) echo "style='display:none'"; ?>>
|
1189 |
8f8682f7
|
Phil Davis
|
<input style="vertical-align:middle" type="checkbox" value="yes" name="netboot" id="netboot" <?php if ($pconfig['netboot']) echo " checked=\"checked\""; ?> />
|
1190 |
|
|
<b><?=gettext("Enables network booting.");?></b>
|
1191 |
|
|
<br/>
|
1192 |
|
|
<table border="0" cellspacing="0" cellpadding="2" summary="network booting">
|
1193 |
|
|
<tr>
|
1194 |
|
|
<td>
|
1195 |
|
|
<?=gettext("Enter the IP of the"); ?> <b><?=gettext("next-server"); ?></b>
|
1196 |
|
|
</td>
|
1197 |
|
|
<td>
|
1198 |
|
|
<input name="nextserver" type="text" class="formfld unknown" id="nextserver" size="20" value="<?=htmlspecialchars($pconfig['nextserver']);?>" /><br />
|
1199 |
|
|
</td>
|
1200 |
|
|
</tr>
|
1201 |
|
|
<tr>
|
1202 |
|
|
<td>
|
1203 |
|
|
<?=gettext("and the default bios filename");?>
|
1204 |
|
|
</td>
|
1205 |
|
|
<td>
|
1206 |
|
|
<input name="filename" type="text" class="formfld unknown" id="filename" size="20" value="<?=htmlspecialchars($pconfig['filename']);?>" /><br />
|
1207 |
|
|
</td>
|
1208 |
|
|
</tr>
|
1209 |
|
|
<tr>
|
1210 |
|
|
<td>
|
1211 |
|
|
<?=gettext("and the UEFI 32bit filename ");?>
|
1212 |
|
|
</td>
|
1213 |
|
|
<td>
|
1214 |
|
|
<input name="filename32" type="text" class="formfld unknown" id="filename32" size="20" value="<?=htmlspecialchars($pconfig['filename32']);?>" /><br />
|
1215 |
|
|
</td>
|
1216 |
|
|
</tr>
|
1217 |
|
|
<tr>
|
1218 |
|
|
<td>
|
1219 |
|
|
<?=gettext("and the UEFI 64bit filename ");?>
|
1220 |
|
|
</td>
|
1221 |
|
|
<td>
|
1222 |
|
|
<input name="filename64" type="text" class="formfld unknown" id="filename64" size="20" value="<?=htmlspecialchars($pconfig['filename64']);?>" /><br />
|
1223 |
|
|
</td>
|
1224 |
|
|
</tr>
|
1225 |
|
|
</table>
|
1226 |
|
|
<?=gettext("Note: You need both a filename and a boot server configured for this to work!");?>
|
1227 |
|
|
<?=gettext("You will need all three filenames and a boot server configured for UEFI to work!");?>
|
1228 |
|
|
<?=gettext("Enter the"); ?> <b><?=gettext("root-path"); ?></b>-<?=gettext("string");?>
|
1229 |
|
|
<input name="rootpath" type="text" class="formfld unknown" id="rootpath" size="90" value="<?=htmlspecialchars($pconfig['rootpath']);?>" /><br />
|
1230 |
|
|
<?=gettext("Note: string-format: iscsi:(servername):(protocol):(port):(LUN):targetname");?>
|
1231 |
|
|
</div>
|
1232 |
|
|
</td>
|
1233 |
|
|
</tr>
|
1234 |
|
|
<?php
|
1235 |
|
|
if (!is_numeric($pool) && !($act == "newpool")):
|
1236 |
|
|
?>
|
1237 |
|
|
<tr>
|
1238 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Additional BOOTP/DHCP Options");?></td>
|
1239 |
|
|
<td width="78%" class="vtable">
|
1240 |
90ad3a76
|
Phil Davis
|
<div id="shownumbervaluebox" <?php if (!empty($pconfig['numberoptions'])) echo "style='display:none'"; ?>>
|
1241 |
8f8682f7
|
Phil Davis
|
<input type="button" onclick="show_shownumbervalue()" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Additional BOOTP/DHCP Options");?>
|
1242 |
|
|
</div>
|
1243 |
90ad3a76
|
Phil Davis
|
<div id="shownumbervalue" <?php if (empty($pconfig['numberoptions'])) echo "style='display:none'"; ?>>
|
1244 |
8f8682f7
|
Phil Davis
|
<table id="maintable" summary="bootp-dhcp options">
|
1245 |
|
|
<tbody>
|
1246 |
|
|
<tr>
|
1247 |
|
|
<td colspan="3">
|
1248 |
|
|
<div style="padding:5px; margin-top: 16px; margin-bottom: 16px; border:1px dashed #000066; background-color: #ffffff; color: #000000; font-size: 8pt;" id="itemhelp">
|
1249 |
|
|
<?=gettext("Enter the DHCP option number and the value for each item you would like to include in the DHCP lease information. For a list of available options please visit this"); ?> <a href="http://www.iana.org/assignments/bootp-dhcp-parameters/" target="_blank"><?=gettext("URL"); ?></a>
|
1250 |
|
|
</div>
|
1251 |
|
|
</td>
|
1252 |
|
|
</tr>
|
1253 |
|
|
<tr>
|
1254 |
|
|
<td><div id="onecolumn"><?=gettext("Number");?></div></td>
|
1255 |
|
|
<td><div id="twocolumn"><?=gettext("Type");?></div></td>
|
1256 |
|
|
<td><div id="threecolumn"><?=gettext("Value");?></div></td>
|
1257 |
|
|
</tr>
|
1258 |
|
|
<?php
|
1259 |
|
|
$counter = 0;
|
1260 |
|
|
if ($pconfig['numberoptions']):
|
1261 |
|
|
foreach ($pconfig['numberoptions']['item'] as $item):
|
1262 |
|
|
$number = $item['number'];
|
1263 |
|
|
$itemtype = $item['type'];
|
1264 |
|
|
$value = $item['value'];
|
1265 |
|
|
?>
|
1266 |
|
|
<tr>
|
1267 |
|
|
<td>
|
1268 |
|
|
<input autocomplete="off" name="number<?php echo $counter; ?>" type="text" class="formfld unknown" id="number<?php echo $counter; ?>" size="10" value="<?=htmlspecialchars($number);?>" />
|
1269 |
|
|
</td>
|
1270 |
|
|
<td>
|
1271 |
|
|
<select name="itemtype<?php echo $counter; ?>" class="formselect" id="itemtype<?php echo $counter; ?>">
|
1272 |
|
|
<?php
|
1273 |
|
|
foreach ($customitemtypes as $typename => $typedescr) {
|
1274 |
|
|
echo "<option value=\"{$typename}\" ";
|
1275 |
|
|
if ($itemtype == $typename) {
|
1276 |
|
|
echo "selected=\"selected\"";
|
1277 |
678dfd0f
|
Erik Fonnesbeck
|
}
|
1278 |
8f8682f7
|
Phil Davis
|
echo ">" . $typedescr . "</option>";
|
1279 |
|
|
}
|
1280 |
|
|
?>
|
1281 |
|
|
</select>
|
1282 |
|
|
</td>
|
1283 |
|
|
<td>
|
1284 |
|
|
<input autocomplete="off" name="value<?php echo $counter; ?>" type="text" class="formfld unknown" id="value<?php echo $counter; ?>" size="40" value="<?=htmlspecialchars($value);?>" />
|
1285 |
|
|
</td>
|
1286 |
|
|
<td>
|
1287 |
|
|
<a onclick="removeRow(this); return false;" href="#"><img border="0" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" alt="delete" /></a>
|
1288 |
|
|
</td>
|
1289 |
|
|
</tr>
|
1290 |
|
|
<?php
|
1291 |
|
|
$counter++;
|
1292 |
|
|
endforeach;
|
1293 |
|
|
endif; // numberoptions
|
1294 |
|
|
?>
|
1295 |
|
|
</tbody>
|
1296 |
|
|
</table>
|
1297 |
|
|
<a onclick="javascript:addRowTo('maintable', 'formfldalias'); return false;" href="#">
|
1298 |
|
|
<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="<?=gettext("add another entry");?>" />
|
1299 |
|
|
</a>
|
1300 |
|
|
<script type="text/javascript">
|
1301 |
|
|
//<![CDATA[
|
1302 |
|
|
field_counter_js = 3;
|
1303 |
|
|
rows = 1;
|
1304 |
|
|
totalrows = <?php echo $counter; ?>;
|
1305 |
|
|
loaded = <?php echo $counter; ?>;
|
1306 |
|
|
//]]>
|
1307 |
|
|
</script>
|
1308 |
|
|
</div>
|
1309 |
|
|
</td>
|
1310 |
|
|
</tr>
|
1311 |
|
|
<?php
|
1312 |
|
|
endif;
|
1313 |
|
|
?>
|
1314 |
|
|
<tr>
|
1315 |
|
|
<td width="22%" valign="top"> </td>
|
1316 |
|
|
<td width="78%">
|
1317 |
|
|
<?php if ($act == "newpool"): ?>
|
1318 |
|
|
<input type="hidden" name="act" value="newpool" />
|
1319 |
|
|
<?php endif; ?>
|
1320 |
|
|
<?php if (is_numeric($pool)): ?>
|
1321 |
|
|
<input type="hidden" name="pool" value="<?php echo $pool; ?>" />
|
1322 |
|
|
<?php endif; ?>
|
1323 |
|
|
<input name="if" type="hidden" value="<?=htmlspecialchars($if);?>" />
|
1324 |
|
|
<input name="submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="enable_change(true)" />
|
1325 |
|
|
</td>
|
1326 |
|
|
</tr>
|
1327 |
|
|
<tr>
|
1328 |
|
|
<td width="22%" valign="top"> </td>
|
1329 |
|
|
<td width="78%">
|
1330 |
|
|
<p>
|
1331 |
|
|
<span class="vexpl">
|
1332 |
|
|
<span class="red"><strong><?=gettext("Note:");?>
|
1333 |
|
|
<br />
|
1334 |
|
|
</strong>
|
1335 |
|
|
</span>
|
1336 |
|
|
<?=gettext("The DNS servers entered in"); ?>
|
1337 |
|
|
<a href="system.php"><?=gettext("System: General setup"); ?></a>
|
1338 |
|
|
<?=gettext("(or the"); ?> <a href="services_dnsmasq.php"><?=gettext("DNS forwarder"); ?></a>, <?=gettext("if enabled)"); ?>
|
1339 |
|
|
</span>
|
1340 |
|
|
<span class="vexpl">
|
1341 |
|
|
<?=gettext("will be assigned to clients by the DHCP server."); ?>
|
1342 |
|
|
<br />
|
1343 |
|
|
<br />
|
1344 |
|
|
<?=gettext("The DHCP lease table can be viewed on the"); ?>
|
1345 |
|
|
<a href="status_dhcp_leases.php"><?=gettext("Status: DHCP leases"); ?></a>
|
1346 |
|
|
<?=gettext("page."); ?>
|
1347 |
|
|
<br />
|
1348 |
|
|
</span>
|
1349 |
|
|
</p>
|
1350 |
|
|
</td>
|
1351 |
de792e62
|
jim-p
|
</tr>
|
1352 |
|
|
</table>
|
1353 |
8f8682f7
|
Phil Davis
|
<?php
|
1354 |
|
|
if (!is_numeric($pool) && !($act == "newpool")):
|
1355 |
|
|
?>
|
1356 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="static mappings">
|
1357 |
|
|
<tr>
|
1358 |
|
|
<td colspan="5" valign="top" class="listtopic"><?=gettext("DHCP Static Mappings for this interface.");?></td>
|
1359 |
|
|
<td> </td>
|
1360 |
|
|
</tr>
|
1361 |
|
|
<tr>
|
1362 |
|
|
<td width="7%" class="listhdrr"><?=gettext("Static ARP");?></td>
|
1363 |
|
|
<td width="18%" class="listhdrr"><?=gettext("MAC address");?></td>
|
1364 |
|
|
<td width="15%" class="listhdrr"><?=gettext("IP address");?></td>
|
1365 |
|
|
<td width="20%" class="listhdrr"><?=gettext("Hostname");?></td>
|
1366 |
|
|
<td width="30%" class="listhdr"><?=gettext("Description");?></td>
|
1367 |
|
|
<td width="10%" class="list">
|
1368 |
|
|
<table border="0" cellspacing="0" cellpadding="1" summary="add">
|
1369 |
|
|
<tr>
|
1370 |
|
|
<td valign="middle" width="17"></td>
|
1371 |
|
|
<td valign="middle">
|
1372 |
|
|
<a href="services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a>
|
1373 |
|
|
</td>
|
1374 |
|
|
</tr>
|
1375 |
|
|
</table>
|
1376 |
|
|
</td>
|
1377 |
|
|
</tr>
|
1378 |
|
|
<?php
|
1379 |
|
|
if (is_array($a_maps)):
|
1380 |
|
|
$i = 0;
|
1381 |
|
|
foreach ($a_maps as $mapent):
|
1382 |
|
|
?>
|
1383 |
|
|
<tr>
|
1384 |
|
|
<td align="center" class="listlr" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&id=<?=$i;?>';">
|
1385 |
|
|
<?php if (isset($mapent['arp_table_static_entry'])): ?>
|
1386 |
|
|
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_alert.gif" alt="ARP Table Static Entry" width="17" height="17" border="0" alt="alert" />
|
1387 |
|
|
<?php endif; ?>
|
1388 |
|
|
</td>
|
1389 |
|
|
<td class="listlr" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&id=<?=$i;?>';">
|
1390 |
|
|
<?=htmlspecialchars($mapent['mac']);?>
|
1391 |
|
|
</td>
|
1392 |
|
|
<td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&id=<?=$i;?>';">
|
1393 |
|
|
<?=htmlspecialchars($mapent['ipaddr']);?>
|
1394 |
|
|
</td>
|
1395 |
|
|
<td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&id=<?=$i;?>';">
|
1396 |
|
|
<?=htmlspecialchars($mapent['hostname']);?>
|
1397 |
|
|
</td>
|
1398 |
|
|
<td class="listbg" ondblclick="document.location='services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&id=<?=$i;?>';">
|
1399 |
|
|
<?=htmlspecialchars($mapent['descr']);?>
|
1400 |
|
|
</td>
|
1401 |
|
|
<td valign="middle" class="list nowrap">
|
1402 |
|
|
<table border="0" cellspacing="0" cellpadding="1" summary="icons">
|
1403 |
|
|
<tr>
|
1404 |
|
|
<td valign="middle"><a href="services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a></td>
|
1405 |
|
|
<td valign="middle"><a href="services_dhcp.php?if=<?=htmlspecialchars($if);?>&act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this mapping?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a></td>
|
1406 |
|
|
</tr>
|
1407 |
|
|
</table>
|
1408 |
|
|
</td>
|
1409 |
|
|
</tr>
|
1410 |
|
|
<?php
|
1411 |
|
|
$i++;
|
1412 |
|
|
endforeach;
|
1413 |
|
|
endif;
|
1414 |
|
|
?>
|
1415 |
|
|
<tr>
|
1416 |
|
|
<td class="list" colspan="5"></td>
|
1417 |
|
|
<td class="list">
|
1418 |
|
|
<table border="0" cellspacing="0" cellpadding="1" summary="add">
|
1419 |
|
|
<tr>
|
1420 |
|
|
<td valign="middle" width="17"></td>
|
1421 |
|
|
<td valign="middle"><a href="services_dhcp_edit.php?if=<?=htmlspecialchars($if);?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
|
1422 |
|
|
</tr>
|
1423 |
|
|
</table>
|
1424 |
|
|
</td>
|
1425 |
|
|
</tr>
|
1426 |
de792e62
|
jim-p
|
</table>
|
1427 |
8f8682f7
|
Phil Davis
|
<?php
|
1428 |
|
|
endif;
|
1429 |
|
|
?>
|
1430 |
|
|
</div>
|
1431 |
de792e62
|
jim-p
|
</td>
|
1432 |
8f8682f7
|
Phil Davis
|
</tr>
|
1433 |
5b237745
|
Scott Ullrich
|
</table>
|
1434 |
|
|
</form>
|
1435 |
91f026b0
|
ayvis
|
<script type="text/javascript">
|
1436 |
180db186
|
Colin Fleming
|
//<![CDATA[
|
1437 |
5b237745
|
Scott Ullrich
|
enable_change(false);
|
1438 |
180db186
|
Colin Fleming
|
//]]>
|
1439 |
5b237745
|
Scott Ullrich
|
</script>
|
1440 |
b7597d4e
|
Bill Marquette
|
<?php include("fend.inc"); ?>
|
1441 |
5b237745
|
Scott Ullrich
|
</body>
|
1442 |
|
|
</html>
|