Project

General

Profile

Download (24.7 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
$pconfig['netboot'] = isset($config['dhcpd'][$if]['netboot']);
76
$pconfig['nextserver'] = $config['dhcpd'][$if]['next-server'];
77
$pconfig['filename'] = $config['dhcpd'][$if]['filename'];
78
$pconfig['failover_peerip'] = $config['dhcpd'][$if]['failover_peerip'];
79
$pconfig['netmask'] = $config['dhcpd'][$if]['netmask'];
80

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

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

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

    
96
if ($_POST) {
97

    
98
	unset($input_errors);
99

    
100
	$pconfig = $_POST;
101

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

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

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

    
114
		}
115

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

    
144

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

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

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

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

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

    
176
		unset($config['dhcpd'][$if]['winsserver']);
177
		if ($_POST['wins1'])
178
			$config['dhcpd'][$if]['winsserver'][] = $_POST['wins1'];
179
		if ($_POST['wins2'])
180
			$config['dhcpd'][$if]['winsserver'][] = $_POST['wins2'];
181

    
182
		unset($config['dhcpd'][$if]['dnsserver']);
183
		if ($_POST['dns1'])
184
			$config['dhcpd'][$if]['dnsserver'][] = $_POST['dns1'];
185
		if ($_POST['dns2'])
186
			$config['dhcpd'][$if]['dnsserver'][] = $_POST['dns2'];
187

    
188
		$config['dhcpd'][$if]['gateway'] = $_POST['gateway'];
189
		$config['dhcpd'][$if]['denyunknown'] = ($_POST['denyunknown']) ? true : false;
190
		$config['dhcpd'][$if]['enable'] = ($_POST['enable']) ? true : false;
191
		$config['dhcpd'][$if]['staticarp'] = ($_POST['staticarp']) ? true : false;
192
		$config['dhcpd'][$if]['ddnsdomain'] = $_POST['ddnsdomain'];
193
		$config['dhcpd'][$if]['ddnsupdate'] = ($_POST['ddnsupdate']) ? true : false;
194
		$config['dhcpd'][$if]['netboot'] = ($_POST['netboot']) ? true : false;
195
		$config['dhcpd'][$if]['next-server'] = $_POST['nextserver'];
196
		$config['dhcpd'][$if]['filename'] = $_POST['filename'];
197

    
198
		write_config();
199

    
200
		/* static arp configuration */
201
		interfaces_staticarp_configure($if);
202

    
203
		$retval = 0;
204
		$retvaldhcp = 0;
205
		$retvaldns = 0;
206
		config_lock();
207
		/* dnsmasq_configure calls dhcpd_configure */
208
		/* no need to restart dhcpd twice */
209
		if (isset($config['dnsmasq']['regdhcpstatic']))	{
210
			$retvaldns = services_dnsmasq_configure();
211
			if ($retvaldns == 0) {
212
				if (file_exists($d_hostsdirty_path))
213
					unlink($d_hostsdirty_path);
214
				if (file_exists($d_staticmapsdirty_path))
215
					unlink($d_staticmapsdirty_path);
216
			}					
217
		} else {
218
			$retvaldhcp = services_dhcpd_configure();	
219
			if ($retvaldhcp == 0) {
220
				if (file_exists($d_staticmapsdirty_path))
221
					unlink($d_staticmapsdirty_path);
222
			}
223
		}	
224
		config_unlock();
225
		if($retvaldhcp == 1 || $retvaldns == 1)
226
			$retval = 1;
227
		$savemsg = get_std_save_message($retval);
228
	}
229
}
230

    
231
if ($_GET['act'] == "del") {
232
	if ($a_maps[$_GET['id']]) {
233
		unset($a_maps[$_GET['id']]);
234
		write_config();
235
		if(isset($config['dhcpd'][$if]['enable'])) {
236
			touch($d_staticmapsdirty_path);
237
			if (isset($config['dnsmasq']['regdhcpstatic']))
238
				touch($d_hostsdirty_path);
239
		}
240
		header("Location: services_dhcp.php?if={$if}");
241
		exit;
242
	}
243
}
244

    
245
$pgtitle = "Services: DHCP server";
246
include("head.inc");
247

    
248
?>
249

    
250
<script type="text/javascript" language="JavaScript">
251

    
252
function enable_change(enable_over) {
253
	var endis;
254
	endis = !(document.iform.enable.checked || enable_over);
255
	document.iform.range_from.disabled = endis;
256
	document.iform.range_to.disabled = endis;
257
	document.iform.wins1.disabled = endis;
258
	document.iform.wins2.disabled = endis;
259
	document.iform.dns1.disabled = endis;
260
	document.iform.dns2.disabled = endis;
261
	document.iform.deftime.disabled = endis;
262
	document.iform.maxtime.disabled = endis;
263
	document.iform.gateway.disabled = endis;
264
	document.iform.failover_peerip.disabled = endis;
265
	document.iform.staticarp.disabled = endis;
266
	document.iform.ddnsdomain.disabled = endis;
267
	document.iform.ddnsupdate.disabled = endis;
268
	document.iform.netboot.disabled = endis;
269
	document.iform.nextserver.disabled = endis;
270
	document.iform.filename.disabled = endis;
271
	document.iform.denyunknown.disabled = endis;
272
}
273

    
274
function show_ddns_config() {
275
	document.getElementById("showddnsbox").innerHTML='';
276
	aodiv = document.getElementById('showddns');
277
	aodiv.style.display = "block";
278
}
279

    
280
function show_netboot_config() {
281
	document.getElementById("shownetbootbox").innerHTML='';
282
	aodiv = document.getElementById('shownetboot');
283
	aodiv.style.display = "block";
284
}
285

    
286
</script>
287

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