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