Project

General

Profile

Download (26.4 KB) Statistics
| Branch: | Tag: | Revision:
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
require("guiconfig.inc");
33

    
34
$if = $_GET['if'];
35
if ($_POST['if'])
36
	$if = $_POST['if'];
37

    
38
/* if OLSRD is enabled, allow WAN to house DHCP. */
39
if($config['installedpackages']['olsrd']) {
40
	foreach($config['installedpackages']['olsrd']['config'] as $olsrd) {
41
			if($olsrd['enable']) {
42
				$iflist = array("lan" => "LAN", "wan" => "WAN");
43
				$is_olsr_enabled = true;
44
				break;
45
			}
46
	}
47
}
48

    
49
if(!$iflist)
50
	$iflist = array("lan" => "LAN");
51

    
52
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
53
	$oc = $config['interfaces']['opt' . $i];
54

    
55
	if (isset($oc['enable']) && $oc['if'] && (!$oc['bridge'])) {
56
		$iflist['opt' . $i] = $oc['descr'];
57
	}
58
}
59

    
60
if (!$if || !isset($iflist[$if]))
61
	$if = "lan";
62

    
63
$pconfig['range_from'] = $config['dhcpd'][$if]['range']['from'];
64
$pconfig['range_to'] = $config['dhcpd'][$if]['range']['to'];
65
$pconfig['deftime'] = $config['dhcpd'][$if]['defaultleasetime'];
66
$pconfig['maxtime'] = $config['dhcpd'][$if]['maxleasetime'];
67
$pconfig['gateway'] = $config['dhcpd'][$if]['gateway'];
68
list($pconfig['wins1'],$pconfig['wins2']) = $config['dhcpd'][$if]['winsserver'];
69
list($pconfig['dns1'],$pconfig['dns2']) = $config['dhcpd'][$if]['dnsserver'];
70
$pconfig['enable'] = isset($config['dhcpd'][$if]['enable']);
71
$pconfig['denyunknown'] = isset($config['dhcpd'][$if]['denyunknown']);
72
$pconfig['staticarp'] = isset($config['dhcpd'][$if]['staticarp']);
73
$pconfig['ddnsdomain'] = $config['dhcpd'][$if]['ddnsdomain'];
74
$pconfig['ddnsupdate'] = isset($config['dhcpd'][$if]['ddnsupdate']);
75
list($pconfig['ntp1'],$pconfig['ntp2']) = $config['dhcpd'][$if]['ntpserver'];
76
$pconfig['netboot'] = isset($config['dhcpd'][$if]['netboot']);
77
$pconfig['nextserver'] = $config['dhcpd'][$if]['next-server'];
78
$pconfig['filename'] = $config['dhcpd'][$if]['filename'];
79
$pconfig['failover_peerip'] = $config['dhcpd'][$if]['failover_peerip'];
80
$pconfig['netmask'] = $config['dhcpd'][$if]['netmask'];
81

    
82
$ifcfg = $config['interfaces'][$if];
83

    
84
if (!is_array($config['dhcpd'][$if]['staticmap'])) {
85
	$config['dhcpd'][$if]['staticmap'] = array();
86
}
87
staticmaps_sort($if);
88
$a_maps = &$config['dhcpd'][$if]['staticmap'];
89

    
90
function is_inrange($test, $start, $end) {
91
	if ( (ip2long($test) < ip2long($end)) && (ip2long($test) > ip2long($start)) )
92
		return true;
93
	else
94
		return false;
95
}
96

    
97
if ($_POST) {
98

    
99
	unset($input_errors);
100

    
101
	$pconfig = $_POST;
102

    
103
	/* input validation */
104
	if ($_POST['enable']) {
105
		$reqdfields = explode(" ", "range_from range_to");
106
		$reqdfieldsn = explode(",", "Range begin,Range end");
107

    
108
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
109

    
110
		foreach($a_maps as $mapent) {
111
			if(is_inrange($mapent['ipaddr'], $_POST['range_from'], $_POST['range_to'])) {
112
				$input_errors[] = "{$mapent['ipaddr']} is inside the range you specified.";
113
			}
114

    
115
		}
116

    
117
		if (($_POST['range_from'] && !is_ipaddr($_POST['range_from']))) {
118
			$input_errors[] = "A valid range must be specified.";
119
		}
120
		if (($_POST['range_to'] && !is_ipaddr($_POST['range_to']))) {
121
			$input_errors[] = "A valid range must be specified.";
122
		}
123
		if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) {
124
			$input_errors[] = "A valid IP address must be specified for the gateway.";
125
		}
126
		if (($_POST['wins1'] && !is_ipaddr($_POST['wins1'])) || ($_POST['wins2'] && !is_ipaddr($_POST['wins2']))) {
127
			$input_errors[] = "A valid IP address must be specified for the primary/secondary WINS servers.";
128
		}
129
		if (($_POST['dns1'] && !is_ipaddr($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddr($_POST['dns2']))) {
130
			$input_errors[] = "A valid IP address must be specified for the primary/secondary DNS servers.";
131
		}
132
		if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60))) {
133
			$input_errors[] = "The default lease time must be at least 60 seconds.";
134
		}
135
		if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime']))) {
136
			$input_errors[] = "The maximum lease time must be at least 60 seconds and higher than the default lease time.";
137
		}
138
		if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain']))) {
139
			$input_errors[] = "A valid domain name must be specified for the dynamic DNS registration.";
140
		}
141
		if (($_POST['ntp1'] && !is_ipaddr($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddr($_POST['ntp2']))) {
142
			$input_errors[] = "A valid IP address must be specified for the primary/secondary NTP servers.";
143
		}
144
		if (($_POST['nextserver'] && !is_ipaddr($_POST['nextserver']))) {
145
			$input_errors[] = "A valid IP address must be specified for the network boot server.";
146
		}
147

    
148

    
149
		if (!$input_errors) {
150
			/* make sure the range lies within the current subnet */
151
			$subnet_start = (ip2long($ifcfg['ipaddr']) & gen_subnet_mask_long($ifcfg['subnet']));
152
			$subnet_end = (ip2long($ifcfg['ipaddr']) | (~gen_subnet_mask_long($ifcfg['subnet'])));
153

    
154
			if ((ip2long($_POST['range_from']) < $subnet_start) || (ip2long($_POST['range_from']) > $subnet_end) ||
155
			    (ip2long($_POST['range_to']) < $subnet_start) || (ip2long($_POST['range_to']) > $subnet_end)) {
156
				$input_errors[] = "The specified range lies outside of the current subnet.";
157
			}
158

    
159
			if (ip2long($_POST['range_from']) > ip2long($_POST['range_to']))
160
				$input_errors[] = "The range is invalid (first element higher than second element).";
161

    
162
			/* make sure that the DHCP Relay isn't enabled on this interface */
163
			if (isset($config['dhcrelay'][$if]['enable']))
164
				$input_errors[] = "You must disable the DHCP relay on the {$iflist[$if]} interface before enabling the DHCP server.";
165
		}
166
	}
167

    
168
	if (!$input_errors) {
169
		$config['dhcpd'][$if]['range']['from'] = $_POST['range_from'];
170
		$config['dhcpd'][$if]['range']['to'] = $_POST['range_to'];
171
		$config['dhcpd'][$if]['defaultleasetime'] = $_POST['deftime'];
172
		$config['dhcpd'][$if]['maxleasetime'] = $_POST['maxtime'];
173
		$config['dhcpd'][$if]['netmask'] = $_POST['netmask'];
174
		$previous = $config['dhcpd'][$if]['failover_peerip'];
175
		if($previous <> $_POST['failover_peerip']) {
176
			mwexec("rm -rf /var/dhcpd/var/db/*");
177
		}
178
		$config['dhcpd'][$if]['failover_peerip'] = $_POST['failover_peerip'];
179

    
180
		unset($config['dhcpd'][$if]['winsserver']);
181
		if ($_POST['wins1'])
182
			$config['dhcpd'][$if]['winsserver'][] = $_POST['wins1'];
183
		if ($_POST['wins2'])
184
			$config['dhcpd'][$if]['winsserver'][] = $_POST['wins2'];
185

    
186
		unset($config['dhcpd'][$if]['dnsserver']);
187
		if ($_POST['dns1'])
188
			$config['dhcpd'][$if]['dnsserver'][] = $_POST['dns1'];
189
		if ($_POST['dns2'])
190
			$config['dhcpd'][$if]['dnsserver'][] = $_POST['dns2'];
191

    
192
		$config['dhcpd'][$if]['gateway'] = $_POST['gateway'];
193
		$config['dhcpd'][$if]['denyunknown'] = ($_POST['denyunknown']) ? true : false;
194
		$config['dhcpd'][$if]['enable'] = ($_POST['enable']) ? true : false;
195
		$config['dhcpd'][$if]['staticarp'] = ($_POST['staticarp']) ? true : false;
196
		$config['dhcpd'][$if]['ddnsdomain'] = $_POST['ddnsdomain'];
197
		$config['dhcpd'][$if]['ddnsupdate'] = ($_POST['ddnsupdate']) ? true : false;
198

    
199
		unset($config['dhcpd'][$if]['ntpserver']);
200
		if ($_POST['ntp1'])
201
			$config['dhcpd'][$if]['ntpserver'][] = $_POST['ntp1'];
202
		if ($_POST['ntp2'])
203
			$config['dhcpd'][$if]['ntpserver'][] = $_POST['ntp2'];
204

    
205
		$config['dhcpd'][$if]['netboot'] = ($_POST['netboot']) ? true : false;
206
		$config['dhcpd'][$if]['next-server'] = $_POST['nextserver'];
207
		$config['dhcpd'][$if]['filename'] = $_POST['filename'];
208

    
209
		write_config();
210

    
211
		/* static arp configuration */
212
		interfaces_staticarp_configure($if);
213

    
214
		$retval = 0;
215
		$retvaldhcp = 0;
216
		$retvaldns = 0;
217
		config_lock();
218
		/* dnsmasq_configure calls dhcpd_configure */
219
		/* no need to restart dhcpd twice */
220
		if (isset($config['dnsmasq']['regdhcpstatic']))	{
221
			$retvaldns = services_dnsmasq_configure();
222
			if ($retvaldns == 0) {
223
				if (file_exists($d_hostsdirty_path))
224
					unlink($d_hostsdirty_path);
225
				if (file_exists($d_staticmapsdirty_path))
226
					unlink($d_staticmapsdirty_path);
227
			}					
228
		} else {
229
			$retvaldhcp = services_dhcpd_configure();	
230
			if ($retvaldhcp == 0) {
231
				if (file_exists($d_staticmapsdirty_path))
232
					unlink($d_staticmapsdirty_path);
233
			}
234
		}	
235
		config_unlock();
236
		if($retvaldhcp == 1 || $retvaldns == 1)
237
			$retval = 1;
238
		$savemsg = get_std_save_message($retval);
239
	}
240
}
241

    
242
if ($_GET['act'] == "del") {
243
	if ($a_maps[$_GET['id']]) {
244
		unset($a_maps[$_GET['id']]);
245
		write_config();
246
		if(isset($config['dhcpd'][$if]['enable'])) {
247
			touch($d_staticmapsdirty_path);
248
			if (isset($config['dnsmasq']['regdhcpstatic']))
249
				touch($d_hostsdirty_path);
250
		}
251
		header("Location: services_dhcp.php?if={$if}");
252
		exit;
253
	}
254
}
255

    
256
$pgtitle = "Services: DHCP server";
257
include("head.inc");
258

    
259
?>
260

    
261
<script type="text/javascript" language="JavaScript">
262

    
263
function enable_change(enable_over) {
264
	var endis;
265
	endis = !(document.iform.enable.checked || enable_over);
266
	document.iform.range_from.disabled = endis;
267
	document.iform.range_to.disabled = endis;
268
	document.iform.wins1.disabled = endis;
269
	document.iform.wins2.disabled = endis;
270
	document.iform.dns1.disabled = endis;
271
	document.iform.dns2.disabled = endis;
272
	document.iform.deftime.disabled = endis;
273
	document.iform.maxtime.disabled = endis;
274
	document.iform.gateway.disabled = endis;
275
	document.iform.failover_peerip.disabled = endis;
276
	document.iform.staticarp.disabled = endis;
277
	document.iform.ddnsdomain.disabled = endis;
278
	document.iform.ddnsupdate.disabled = endis;
279
	document.iform.ntp1.disabled = endis;
280
	document.iform.ntp2.disabled = endis;
281
	document.iform.netboot.disabled = endis;
282
	document.iform.nextserver.disabled = endis;
283
	document.iform.filename.disabled = endis;
284
	document.iform.denyunknown.disabled = endis;
285
}
286

    
287
function show_ddns_config() {
288
	document.getElementById("showddnsbox").innerHTML='';
289
	aodiv = document.getElementById('showddns');
290
	aodiv.style.display = "block";
291
}
292

    
293
function show_ntp_config() {
294
	document.getElementById("showntpbox").innerHTML='';
295
	aodiv = document.getElementById('showntp');
296
	aodiv.style.display = "block";
297
}
298

    
299
function show_netboot_config() {
300
	document.getElementById("shownetbootbox").innerHTML='';
301
	aodiv = document.getElementById('shownetboot');
302
	aodiv.style.display = "block";
303
}
304

    
305
</script>
306

    
307
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
308
<?php include("fbegin.inc"); ?>
309
<p class="pgtitle"><?=$pgtitle?></p>
310
<form action="services_dhcp.php" method="post" name="iform" id="iform">
311
<?php if ($input_errors) print_input_errors($input_errors); ?>
312
<?php if ($savemsg) print_info_box($savemsg); ?>
313
<?php if (file_exists($d_staticmapsdirty_path)): ?><p>
314
<?php print_info_box_np("The static mapping configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
315
<?php endif; ?>
316
<table width="100%" border="0" cellpadding="0" cellspacing="0">
317
  <tr><td>
318
  <?php
319
	/* active tabs */
320
	$tab_array = array();
321
	$tabscounter = 0;
322
	$i = 0;
323
	foreach ($iflist as $ifent => $ifname) {
324
		if ($ifent == $if)
325
			$active = true;
326
		else
327
			$active = false;
328
		$tab_array[] = array($ifname, $active, "services_dhcp.php?if={$ifent}");
329
	}
330
	display_top_tabs($tab_array);
331
  ?>
332
  </td></tr>
333
  <tr>
334
    <td>
335
	<div id="mainarea">
336
              <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
337
                      <tr>
338
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
339
                        <td width="78%" class="vtable">
340
			  <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
341
                          <strong>Enable DHCP server on
342
                          <?=htmlspecialchars($iflist[$if]);?>
343
                          interface</strong></td>
344
                      </tr>
345
				  <tr>
346
	              <td width="22%" valign="top" class="vtable">&nbsp;</td>
347
                      <td width="78%" class="vtable">
348
			<input name="denyunknown" id="denyunknown" type="checkbox" value="yes" <?php if ($pconfig['denyunknown']) echo "checked"; ?>>
349
                      <strong>Deny unknown clients</strong><br>
350
                      If this is checked, only the clients defined below will get DHCP leases from this server. </td>
351
		      		  </tr>
352
                      <tr>
353
                        <td width="22%" valign="top" class="vncellreq">Subnet</td>
354
                        <td width="78%" class="vtable">
355
                          <?=gen_subnet($ifcfg['ipaddr'], $ifcfg['subnet']);?>
356
                        </td>
357
                      </tr>
358
                      <tr>
359
                        <td width="22%" valign="top" class="vncellreq">Subnet
360
                          mask</td>
361
                        <td width="78%" class="vtable">
362
                          <?=gen_subnet_mask($ifcfg['subnet']);?>
363
                        </td>
364
                      </tr>
365
                      <tr>
366
                        <td width="22%" valign="top" class="vncellreq">Available
367
                          range</td>
368
                        <td width="78%" class="vtable">
369
                          <?=long2ip(ip2long($ifcfg['ipaddr']) & gen_subnet_mask_long($ifcfg['subnet']));?>
370
                          -
371
                          <?=long2ip(ip2long($ifcfg['ipaddr']) | (~gen_subnet_mask_long($ifcfg['subnet']))); ?>
372
                        </td>
373
                      </tr>
374
					  <?php if($is_olsr_enabled): ?>
375
                      <tr>
376
                        <td width="22%" valign="top" class="vncellreq">Subnet Mask</td>
377
                        <td width="78%" class="vtable">
378
	                        <select name="netmask" class="formfld" id="netmask">
379
							<?php
380
							for ($i = 32; $i > 0; $i--) {
381
								if($i <> 31) {
382
									echo "<option value=\"{$i}\" ";
383
									if ($i == $pconfig['subnet']) echo "selected";
384
									echo ">" . $i . "</option>";
385
								}
386
							}
387
							?>
388
							</select>
389
                        </td>
390
                      </tr>
391
                      <?php endif; ?>
392
                      <tr>
393
                        <td width="22%" valign="top" class="vncellreq">Range</td>
394
                        <td width="78%" class="vtable">
395
                          <input name="range_from" type="text" class="formfld" id="range_from" size="20" value="<?=htmlspecialchars($pconfig['range_from']);?>">
396
                          &nbsp;to&nbsp; <input name="range_to" type="text" class="formfld" id="range_to" size="20" value="<?=htmlspecialchars($pconfig['range_to']);?>">
397
			</td>
398
                      </tr>
399
                      <tr>
400
                        <td width="22%" valign="top" class="vncell">WINS servers</td>
401
                        <td width="78%" class="vtable">
402
                          <input name="wins1" type="text" class="formfld" id="wins1" size="20" value="<?=htmlspecialchars($pconfig['wins1']);?>"><br>
403
                          <input name="wins2" type="text" class="formfld" id="wins2" size="20" value="<?=htmlspecialchars($pconfig['wins2']);?>">
404
			</td>
405
                      </tr>
406
                      <tr>
407
                        <td width="22%" valign="top" class="vncell">DNS servers</td>
408
                        <td width="78%" class="vtable">
409
                          <input name="dns1" type="text" class="formfld" id="dns1" size="20" value="<?=htmlspecialchars($pconfig['dns1']);?>"><br>
410
                          <input name="dns2" type="text" class="formfld" id="dns2" size="20" value="<?=htmlspecialchars($pconfig['dns2']);?>"><br>
411
			  NOTE: leave blank to use the system default DNS servers.  This option is handy when your doing CARP+DHCP Failover, etc.
412
			</td>
413
                      </tr>
414
                     <tr>
415
                       <td width="22%" valign="top" class="vncell">Gateway</td>
416
                       <td width="78%" class="vtable">
417
                         <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>"><br>
418
			 The default is to use the IP of the firewall as the gateway.  Specify an alternate gateway here if this is not the correct gateway for your network.
419
			</td>
420
                     </tr>
421
                      <tr>
422
                        <td width="22%" valign="top" class="vncell">Default lease
423
                          time</td>
424
                        <td width="78%" class="vtable">
425
                          <input name="deftime" type="text" class="formfld" id="deftime" size="10" value="<?=htmlspecialchars($pconfig['deftime']);?>">
426
                          seconds<br>
427
                          This is used for clients that do not ask for a specific
428
                          expiration time.<br>
429
                          The default is 7200 seconds.
430
			</td>
431
                      </tr>
432
                      <tr>
433
                        <td width="22%" valign="top" class="vncell">Maximum lease
434
                          time</td>
435
                        <td width="78%" class="vtable">
436
                          <input name="maxtime" type="text" class="formfld" id="maxtime" size="10" value="<?=htmlspecialchars($pconfig['maxtime']);?>">
437
                          seconds<br>
438
                          This is the maximum lease time for clients that ask
439
                          for a specific expiration time.<br>
440
                          The default is 86400 seconds.
441
			</td>
442
                      </tr>
443
                      <tr>
444
                        <td width="22%" valign="top" class="vncell">Failover peer IP:</td>
445
                        <td width="78%" class="vtable">
446
				<input name="failover_peerip" type="text" class="formfld" id="failover_peerip" size="20" value="<?=htmlspecialchars($pconfig['failover_peerip']);?>"><br>
447
				Leave blank to disable.  Enter the REAL address of the other machine.  Machines must be using CARP.
448
			</td>
449
		      </tr>
450
                      <tr>
451
                        <td width="22%" valign="top" class="vncell">Static ARP</td>
452
                        <td width="78%" class="vtable">
453
				<table>
454
					<tr>
455
						<td>
456
							<input valign="middle" type="checkbox" value="yes" name="staticarp" id="staticarp" <?php if($pconfig['staticarp']) echo " checked"; ?>>&nbsp;
457
						</td>
458
						<td>
459
							<b>Enable Static ARP entries</b>
460
						</td>
461
					</tr>
462
					<tr>
463
						<td>
464
							&nbsp;
465
						</td>
466
						<td>
467
							<span class="red"><strong>Note:</strong></span> Only the machines listed below will be able to communicate with the firewall on this NIC.
468
						</td>
469
					</tr>
470
				</table>
471
			</td>
472
                      </tr>
473
                      <tr>
474
                        <td width="22%" valign="top" class="vncell">Dynamic DNS</td>
475
                        <td width="78%" class="vtable">
476
				<div id="showddnsbox">
477
					<input type="button" onClick="show_ddns_config()" value="Advanced"></input> - Show Dynamic DNS</a>
478
				</div>
479
				<div id="showddns" style="display:none">
480
					<input valign="middle" type="checkbox" value="yes" name="ddnsupdate" id="ddnsupdate" <?php if($pconfig['ddnsupdate']) echo " checked"; ?>>&nbsp;
481
					<b>Enable registration of DHCP client names in DNS.</b><br />
482
					<p>
483
					<input name="ddnsdomain" type="text" class="formfld" id="ddnsdomain" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomain']);?>"><br />
484
					Note: Leave blank to disable dynamic DNS registration.<br />
485
					Enter the dynamic DNS domain which will be used to register client names in the DNS server.
486
				</div>
487
			</td>
488
		      </tr>
489
                      <tr>
490
                        <td width="22%" valign="top" class="vncell">NTP servers</td>
491
                        <td width="78%" class="vtable">
492
				<div id="showntpbox">
493
					<input type="button" onClick="show_ntp_config()" value="Advanced"></input> - Show NTP configuration</a>
494
				</div>
495
				<div id="showntp" style="display:none">
496
					<input name="ntp1" type="text" class="formfld" id="ntp1" size="20" value="<?=htmlspecialchars($pconfig['ntp1']);?>"><br>
497
					<input name="ntp2" type="text" class="formfld" id="ntp2" size="20" value="<?=htmlspecialchars($pconfig['ntp2']);?>">
498
				</div>
499
			</td>
500
                      </tr>
501
                      <tr>
502
                        <td width="22%" valign="top" class="vncell">Enable Network booting</td>
503
                        <td width="78%" class="vtable">
504
				<div id="shownetbootbox">
505
					<input type="button" onClick="show_netboot_config()" value="Advanced"></input> - Show Network booting</a>
506
				</div>
507
				<div id="shownetboot" style="display:none">
508
					<input valign="middle" type="checkbox" value="yes" name="netboot" id="netboot" <?php if($pconfig['netboot']) echo " checked"; ?>>&nbsp;
509
					<b>Enables network booting.</b>
510
					<p>
511
					<input name="nextserver" type="text" class="formfld" id="nextserver" size="20" value="<?=htmlspecialchars($pconfig['nextserver']);?>"><br>
512
					Enter the IP address from the network boot server.
513
					<p>
514
					<input name="filename" type="text" class="formfld" id="filename" size="20" value="<?=htmlspecialchars($pconfig['filename']);?>"><br>
515
					Enter the filename used for network booting.<br />
516
					Note: You need both a filename and a boot server configured for this to work!
517
				</div>
518
			</td>
519
		      </tr>
520
                      <tr>
521
                        <td width="22%" valign="top">&nbsp;</td>
522
                        <td width="78%">
523
                          <input name="if" type="hidden" value="<?=$if;?>">
524
                          <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
525
                        </td>
526
                      </tr>
527
                      <tr>
528
                        <td width="22%" valign="top">&nbsp;</td>
529
                        <td width="78%"> <p><span class="vexpl"><span class="red"><strong>Note:<br>
530
                            </strong></span>The DNS servers entered in <a href="system.php">System:
531
                            General setup</a> (or the <a href="services_dnsmasq.php">DNS
532
                            forwarder</a>, if enabled) </span><span class="vexpl">will
533
                            be assigned to clients by the DHCP server.<br>
534
                            <br>
535
                            The DHCP lease table can be viewed on the <a href="diag_dhcp_leases.php">Diagnostics:
536
                            DHCP leases</a> page.<br>
537
                            </span></p>
538
			</td>
539
                      </tr>
540
                    </table>
541
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
542
                <tr>
543
                  <td width="25%" class="listhdrr">MAC address</td>
544
                  <td width="15%" class="listhdrr">IP address</td>
545
				  <td width="20%" class="listhdrr">Hostname</td>
546
                  <td width="30%" class="listhdr">Description</td>
547
                  <td width="10%" class="list">
548
                    <table border="0" cellspacing="0" cellpadding="1">
549
                      <tr>
550
			<td valign="middle" width="17"></td>
551
                        <td valign="middle"><a href="services_dhcp_edit.php?if=<?=$if;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
552
                      </tr>
553
                    </table>
554
		  </td>
555
		</tr>
556
			  <?php if(is_array($a_maps)): ?>
557
			  <?php $i = 0; foreach ($a_maps as $mapent): ?>
558
			  <?php if($mapent['mac'] <> "" or $mapent['ipaddr'] <> ""): ?>
559
                <tr>
560
                  <td class="listlr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
561
                    <?=htmlspecialchars($mapent['mac']);?>
562
                  </td>
563
                  <td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
564
                    <?=htmlspecialchars($mapent['ipaddr']);?>&nbsp;
565
                  </td>
566
                  <td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
567
                    <?=htmlspecialchars($mapent['hostname']);?>&nbsp;
568
                  </td>	
569
                  <td class="listbg" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
570
                    <font color="#FFFFFF"><?=htmlspecialchars($mapent['descr']);?>&nbsp;</font>
571
                  </td>
572
                  <td valign="middle" nowrap class="list">
573
                    <table border="0" cellspacing="0" cellpadding="1">
574
                      <tr>
575
                        <td valign="middle"><a href="services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
576
                        <td valign="middle"><a href="services_dhcp.php?if=<?=$if;?>&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this mapping?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
577
                      </tr>
578
                    </table>
579
                  </td>
580
                </tr>
581
		<?php endif; ?>
582
		<?php $i++; endforeach; ?>
583
		<?php endif; ?>
584
                <tr>
585
                  <td class="list" colspan="4"></td>
586
                  <td class="list">
587
                    <table border="0" cellspacing="0" cellpadding="1">
588
                      <tr>
589
			<td valign="middle" width="17"></td>
590
                        <td valign="middle"><a href="services_dhcp_edit.php?if=<?=$if;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
591
                      </tr>
592
                    </table>
593
                  </td>
594
                </tr>
595
              </table>
596
	</div>
597
    </td>
598
  </tr>
599
</table>
600
</form>
601
<script language="JavaScript">
602
<!--
603
enable_change(false);
604
//-->
605
</script>
606
<?php include("fend.inc"); ?>
607
</body>
608
</html>
(108-108/171)