Project

General

Profile

« Previous | Next » 

Revision de792e62

Added by Jim Pingle over 15 years ago

Fix whitespace while I'm here.

View differences:

usr/local/www/services_dhcp.php
47 47
	exit;
48 48
}
49 49

  
50
/*  Fix failover DHCP problem 
50
/*  Fix failover DHCP problem
51 51
 *  http://article.gmane.org/gmane.comp.security.firewalls.pfsense.support/18749
52 52
 */
53 53
ini_set("memory_limit","64M");
......
120 120
/* set the starting interface */
121 121
if (!$if || !isset($iflist[$if])) {
122 122
	foreach ($iflist as $ifent => $ifname) {
123
        	$oc = $config['interfaces'][$ifent];
124
		if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddr($oc['ipaddr']))) || 
123
		$oc = $config['interfaces'][$ifent];
124
		if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddr($oc['ipaddr']))) ||
125 125
			(!is_array($config['dhcpd'][$ifent]) && (!is_ipaddr($oc['ipaddr']))))
126 126
			continue;
127 127
		$if = $ifent;
......
133 133
	if (is_array($config['dhcpd'][$if]['range'])) {
134 134
		$pconfig['range_from'] = $config['dhcpd'][$if]['range']['from'];
135 135
		$pconfig['range_to'] = $config['dhcpd'][$if]['range']['to'];
136
	}	
136
	}
137 137
	$pconfig['deftime'] = $config['dhcpd'][$if]['defaultleasetime'];
138 138
	$pconfig['maxtime'] = $config['dhcpd'][$if]['maxleasetime'];
139 139
	$pconfig['gateway'] = $config['dhcpd'][$if]['gateway'];
......
156 156
	$pconfig['failover_peerip'] = $config['dhcpd'][$if]['failover_peerip'];
157 157
	$pconfig['netmask'] = $config['dhcpd'][$if]['netmask'];
158 158
	$pconfig['numberoptions'] = $config['dhcpd'][$if]['numberoptions'];
159
	if (!is_array($config['dhcpd'][$if]['staticmap'])) 
160
        	$config['dhcpd'][$if]['staticmap'] = array();
159
	if (!is_array($config['dhcpd'][$if]['staticmap']))
160
		$config['dhcpd'][$if]['staticmap'] = array();
161 161
	$a_maps = &$config['dhcpd'][$if]['staticmap'];
162 162
}
163 163

  
......
165 165
$ifcfgsn = get_interface_subnet($if);
166 166

  
167 167
/*   set the enabled flag which will tell us if DHCP relay is enabled
168
 *   on any interface.   We will use this to disable DHCP server since
168
 *   on any interface. We will use this to disable DHCP server since
169 169
 *   the two are not compatible with each other.
170 170
 */
171 171

  
......
211 211
		$reqdfieldsn = explode(",", "Range begin,Range end");
212 212

  
213 213
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
214
		
215
		if (($_POST['range_from'] && !is_ipaddr($_POST['range_from']))) 
214

  
215
		if (($_POST['range_from'] && !is_ipaddr($_POST['range_from'])))
216 216
			$input_errors[] = "A valid range must be specified.";
217
		if (($_POST['range_to'] && !is_ipaddr($_POST['range_to']))) 
217
		if (($_POST['range_to'] && !is_ipaddr($_POST['range_to'])))
218 218
			$input_errors[] = "A valid range must be specified.";
219
		if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) 
219
		if (($_POST['gateway'] && !is_ipaddr($_POST['gateway'])))
220 220
			$input_errors[] = "A valid IP address must be specified for the gateway.";
221
		if (($_POST['wins1'] && !is_ipaddr($_POST['wins1'])) || ($_POST['wins2'] && !is_ipaddr($_POST['wins2']))) 
221
		if (($_POST['wins1'] && !is_ipaddr($_POST['wins1'])) || ($_POST['wins2'] && !is_ipaddr($_POST['wins2'])))
222 222
			$input_errors[] = "A valid IP address must be specified for the primary/secondary WINS servers.";
223
		if (($_POST['dns1'] && !is_ipaddr($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddr($_POST['dns2']))) 
223
		if (($_POST['dns1'] && !is_ipaddr($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddr($_POST['dns2'])))
224 224
			$input_errors[] = "A valid IP address must be specified for the primary/secondary DNS servers.";
225 225

  
226
		if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60))) 
226
		if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60)))
227 227
			$input_errors[] = "The default lease time must be at least 60 seconds.";
228
		if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime']))) 
228
		if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime'])))
229 229
			$input_errors[] = "The maximum lease time must be at least 60 seconds and higher than the default lease time.";
230
		if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain']))) 
230
		if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain'])))
231 231
			$input_errors[] = "A valid domain name must be specified for the dynamic DNS registration.";
232
		if (($_POST['ntp1'] && !is_ipaddr($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddr($_POST['ntp2']))) 
232
		if (($_POST['ntp1'] && !is_ipaddr($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddr($_POST['ntp2'])))
233 233
			$input_errors[] = "A valid IP address must be specified for the primary/secondary NTP servers.";
234 234
		if (($_POST['domain'] && !is_domain($_POST['domain'])))
235 235
			$input_errors[] = "A valid domain name must be specified for the DNS domain.";
236 236
		if (($_POST['tftp'] && (!is_ipaddr($_POST['tftp']) && !is_domain($_POST['tftp']))))
237 237
			$input_errors[] = "A valid IP address or hostname must be specified for the TFTP server.";
238
		if (($_POST['nextserver'] && !is_ipaddr($_POST['nextserver']))) 
238
		if (($_POST['nextserver'] && !is_ipaddr($_POST['nextserver'])))
239 239
			$input_errors[] = "A valid IP address must be specified for the network boot server.";
240 240

  
241 241
		if(gen_subnet($ifcfgip, $ifcfgsn) == $_POST['range_from'])
......
246 246
		// Disallow a range that includes the virtualip
247 247
		if (is_array($config['virtualip']['vip'])) {
248 248
			foreach($config['virtualip']['vip'] as $vip) {
249
				if($vip['interface'] == $if) 
250
					if($vip['subnet'] && is_inrange($vip['subnet'], $_POST['range_from'], $_POST['range_to'])) 
249
				if($vip['interface'] == $if)
250
					if($vip['subnet'] && is_inrange($vip['subnet'], $_POST['range_from'], $_POST['range_to']))
251 251
						$input_errors[] = "The subnet range cannot overlap with virtual IP address {$vip['subnet']}.";
252 252
			}
253 253
		}
......
283 283
		$config['dhcpd'][$if]['maxleasetime'] = $_POST['maxtime'];
284 284
		$config['dhcpd'][$if]['netmask'] = $_POST['netmask'];
285 285
		$previous = $config['dhcpd'][$if]['failover_peerip'];
286
		if($previous <> $_POST['failover_peerip']) 
286
		if($previous <> $_POST['failover_peerip'])
287 287
			mwexec("/bin/rm -rf /var/dhcpd/var/db/*");
288 288

  
289 289
		$config['dhcpd'][$if]['failover_peerip'] = $_POST['failover_peerip'];
......
346 346
			if ($retvaldns == 0) {
347 347
				clear_subsystem_dirty('hosts');
348 348
				clear_subsystem_dirty('staticmaps');
349
			}					
349
			}
350 350
		} else {
351
			$retvaldhcp = services_dhcpd_configure();	
351
			$retvaldhcp = services_dhcpd_configure();
352 352
			if ($retvaldhcp == 0)
353 353
				clear_subsystem_dirty('staticmaps');
354
		}	
354
		}
355 355
		if($retvaldhcp == 1 || $retvaldns == 1)
356 356
			$retval = 1;
357 357
		$savemsg = get_std_save_message($retval);
......
461 461
<form action="services_dhcp.php" method="post" name="iform" id="iform">
462 462
<?php if ($input_errors) print_input_errors($input_errors); ?>
463 463
<?php if ($savemsg) print_info_box($savemsg); ?>
464
<?php 
464
<?php
465 465
	if ($dhcrelay_enabled) {
466
		echo "DHCP Relay is currently enabled.  Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.";
467
		include("fend.inc"); 
466
		echo "DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.";
467
		include("fend.inc");
468 468
		echo "</body>";
469 469
		echo "</html>";
470 470
		exit;
......
474 474
<?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>
475 475
<?php endif; ?>
476 476
<table width="100%" border="0" cellpadding="0" cellspacing="0">
477
  <tr><td>
478
  <?php
477
<tr><td>
478
<?php
479 479
	/* active tabs */
480 480
	$tab_array = array();
481 481
	$tabscounter = 0;
482 482
	$i = 0;
483 483
	foreach ($iflist as $ifent => $ifname) {
484
        	$oc = $config['interfaces'][$ifent];
485
		if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddr($oc['ipaddr']))) || 
484
		$oc = $config['interfaces'][$ifent];
485
		if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddr($oc['ipaddr']))) ||
486 486
			(!is_array($config['dhcpd'][$ifent]) && (!is_ipaddr($oc['ipaddr']))))
487 487
			continue;
488 488
		if ($ifent == $if)
......
500 500
		exit;
501 501
	}
502 502
	display_top_tabs($tab_array);
503
  ?>
504
  </td></tr>
505
  <tr>
506
    <td>
503
?>
504
</td></tr>
505
<tr>
506
<td>
507 507
	<div id="mainarea">
508
              <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
509
                      <tr>
510
                        <td width="22%" valign="top" class="vtable">&nbsp;</td>
511
                        <td width="78%" class="vtable">
512
			  			<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
513
                          <strong>Enable DHCP server on
514
                          <?=htmlspecialchars($iflist[$if]);?>
515
                          interface</strong></td>
516
                      </tr>
517
				  <tr>
518
	              <td width="22%" valign="top" class="vtable">&nbsp;</td>
519
                      <td width="78%" class="vtable">
520
					  <input name="denyunknown" id="denyunknown" type="checkbox" value="yes" <?php if ($pconfig['denyunknown']) echo "checked"; ?>>
521
                      <strong>Deny unknown clients</strong><br>
522
                      If this is checked, only the clients defined below will get DHCP leases from this server. </td>
523
		      		  </tr>
524
                      <tr>
525
                        <td width="22%" valign="top" class="vncellreq">Subnet</td>
526
                        <td width="78%" class="vtable">
527
                          <?=gen_subnet($ifcfgip, $ifcfgsn);?>
528
                        </td>
529
                      </tr>
530
                      <tr>
531
                        <td width="22%" valign="top" class="vncellreq">Subnet mask</td>
532
                        <td width="78%" class="vtable">
533
                          <?=gen_subnet_mask($ifcfgsn);?>
534
                        </td>
535
                      </tr>
536
                      <tr>
537
                        <td width="22%" valign="top" class="vncellreq">Available range</td>
538
                        <td width="78%" class="vtable">
539
                          <?php 
540
								$range_from = ip2long(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn))); 
541
								$range_from++;
542
								echo long2ip32($range_from);
543
							?>
544
                          -
545
                          <?php
546
								$range_to = ip2long(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
547
								$range_to--;
548
								echo long2ip32($range_to);
549
						  ?>
550
                        </td>
551
                      </tr>
552
					  <?php if($is_olsr_enabled): ?>
553
                      <tr>
554
                        <td width="22%" valign="top" class="vncellreq">Subnet Mask</td>
555
                        <td width="78%" class="vtable">
556
	                        <select name="netmask" class="formselect" id="netmask">
557
							<?php
558
							for ($i = 32; $i > 0; $i--) {
559
								if($i <> 31) {
560
									echo "<option value=\"{$i}\" ";
561
									if ($i == $pconfig['netmask']) echo "selected";
562
									echo ">" . $i . "</option>";
563
								}
564
							}
565
							?>
566
							</select>
567
                        </td>
568
                      </tr>
569
                      <?php endif; ?>
570
                      <tr>
571
                        <td width="22%" valign="top" class="vncellreq">Range</td>
572
                        <td width="78%" class="vtable">
573
                          <input name="range_from" type="text" class="formfld unknown" id="range_from" size="20" value="<?=htmlspecialchars($pconfig['range_from']);?>">
574
                          &nbsp;to&nbsp; <input name="range_to" type="text" class="formfld unknown" id="range_to" size="20" value="<?=htmlspecialchars($pconfig['range_to']);?>">
575
					   </td>
576
                      </tr>
577
                      <tr>
578
                        <td width="22%" valign="top" class="vncell">WINS servers</td>
579
                        <td width="78%" class="vtable">
580
                          <input name="wins1" type="text" class="formfld unknown" id="wins1" size="20" value="<?=htmlspecialchars($pconfig['wins1']);?>"><br>
581
                          <input name="wins2" type="text" class="formfld unknown" id="wins2" size="20" value="<?=htmlspecialchars($pconfig['wins2']);?>">
582
					   </td>
583
                      </tr>
584
                      <tr>
585
                        <td width="22%" valign="top" class="vncell">DNS servers</td>
586
                        <td width="78%" class="vtable">
587
                          <input name="dns1" type="text" class="formfld unknown" id="dns1" size="20" value="<?=htmlspecialchars($pconfig['dns1']);?>"><br>
588
                          <input name="dns2" type="text" class="formfld unknown" id="dns2" size="20" value="<?=htmlspecialchars($pconfig['dns2']);?>"><br>
589
					   	  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.  
590
					   </td>
591
                      </tr>
592
                     <tr>
593
                       <td width="22%" valign="top" class="vncell">Gateway</td>
594
                       <td width="78%" class="vtable">
595
                         <input name="gateway" type="text" class="formfld host" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>"><br>
596
			 			 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.
597
					   </td>
598
                     </tr>
599
                      <tr>
600
                       <td width="22%" valign="top" class="vncell">Domain name</td>
601
                       <td width="78%" class="vtable">
602
                         <input name="domain" type="text" class="formfld unknown" id="domain" size="20" value="<?=htmlspecialchars($pconfig['domain']);?>"><br>
603
			 			 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.
604
					 </td>
605
                     </tr>
606
                      <tr>
607
                       <td width="22%" valign="top" class="vncell">Domain search list</td>
608
                       <td width="78%" class="vtable">
609
                         <input name="domainsearchlist" type="text" class="formfld unknown" id="domainsearchlist" size="20" value="<?=htmlspecialchars($pconfig['domainsearchlist']);?>"><br>
610
			 				The DHCP server can optionally provide a domain search list.
611
						</td>
612
                     </tr>                     
613
                      <tr>
614
                        <td width="22%" valign="top" class="vncell">Default lease time</td>
615
                        <td width="78%" class="vtable">
616
                          <input name="deftime" type="text" class="formfld unknown" id="deftime" size="10" value="<?=htmlspecialchars($pconfig['deftime']);?>">
617
                          seconds<br>
618
                          This is used for clients that do not ask for a specific
619
                          expiration time.<br>
620
                          The default is 7200 seconds.
621
					   </td>
622
                      </tr>
623
                      <tr>
624
                        <td width="22%" valign="top" class="vncell">Maximum lease time</td>
625
                        <td width="78%" class="vtable">
626
                          <input name="maxtime" type="text" class="formfld unknown" id="maxtime" size="10" value="<?=htmlspecialchars($pconfig['maxtime']);?>">
627
                          seconds<br>
628
                          This is the maximum lease time for clients that ask
629
                          for a specific expiration time.<br>
630
                          The default is 86400 seconds.
631
					   </td>
632
                      </tr>
633
                      <tr>
634
                        <td width="22%" valign="top" class="vncell">Failover peer IP:</td>
635
                        <td width="78%" class="vtable">
508
		<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
509
			<tr>
510
			<td width="22%" valign="top" class="vtable">&nbsp;</td>
511
			<td width="78%" class="vtable">
512
				<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
513
			<strong>Enable DHCP server on
514
			<?=htmlspecialchars($iflist[$if]);?>
515
			interface</strong></td>
516
			</tr>
517
			<tr>
518
			<td width="22%" valign="top" class="vtable">&nbsp;</td>
519
			<td width="78%" class="vtable">
520
				<input name="denyunknown" id="denyunknown" type="checkbox" value="yes" <?php if ($pconfig['denyunknown']) echo "checked"; ?>>
521
				<strong>Deny unknown clients</strong><br>
522
				If this is checked, only the clients defined below will get DHCP leases from this server. </td>
523
			</tr>
524
			<tr>
525
			<td width="22%" valign="top" class="vncellreq">Subnet</td>
526
			<td width="78%" class="vtable">
527
				<?=gen_subnet($ifcfgip, $ifcfgsn);?>
528
			</td>
529
			</tr>
530
			<tr>
531
			<td width="22%" valign="top" class="vncellreq">Subnet mask</td>
532
			<td width="78%" class="vtable">
533
				<?=gen_subnet_mask($ifcfgsn);?>
534
			</td>
535
			</tr>
536
			<tr>
537
			<td width="22%" valign="top" class="vncellreq">Available range</td>
538
			<td width="78%" class="vtable">
539
			<?php
540
				$range_from = ip2long(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
541
				$range_from++;
542
				echo long2ip32($range_from);
543
			?>
544
			-
545
			<?php
546
				$range_to = ip2long(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
547
				$range_to--;
548
				echo long2ip32($range_to);
549
			?>
550
			</td>
551
			</tr>
552
			<?php if($is_olsr_enabled): ?>
553
			<tr>
554
			<td width="22%" valign="top" class="vncellreq">Subnet Mask</td>
555
			<td width="78%" class="vtable">
556
				<select name="netmask" class="formselect" id="netmask">
557
				<?php
558
				for ($i = 32; $i > 0; $i--) {
559
					if($i <> 31) {
560
						echo "<option value=\"{$i}\" ";
561
						if ($i == $pconfig['netmask']) echo "selected";
562
						echo ">" . $i . "</option>";
563
					}
564
				}
565
				?>
566
				</select>
567
			</td>
568
			</tr>
569
			<?php endif; ?>
570
			<tr>
571
			<td width="22%" valign="top" class="vncellreq">Range</td>
572
			<td width="78%" class="vtable">
573
				<input name="range_from" type="text" class="formfld unknown" id="range_from" size="20" value="<?=htmlspecialchars($pconfig['range_from']);?>">
574
				&nbsp;to&nbsp; <input name="range_to" type="text" class="formfld unknown" id="range_to" size="20" value="<?=htmlspecialchars($pconfig['range_to']);?>">
575
			</td>
576
			</tr>
577
			<tr>
578
			<td width="22%" valign="top" class="vncell">WINS servers</td>
579
			<td width="78%" class="vtable">
580
				<input name="wins1" type="text" class="formfld unknown" id="wins1" size="20" value="<?=htmlspecialchars($pconfig['wins1']);?>"><br>
581
				<input name="wins2" type="text" class="formfld unknown" id="wins2" size="20" value="<?=htmlspecialchars($pconfig['wins2']);?>">
582
			</td>
583
			</tr>
584
			<tr>
585
			<td width="22%" valign="top" class="vncell">DNS servers</td>
586
			<td width="78%" class="vtable">
587
				<input name="dns1" type="text" class="formfld unknown" id="dns1" size="20" value="<?=htmlspecialchars($pconfig['dns1']);?>"><br>
588
				<input name="dns2" type="text" class="formfld unknown" id="dns2" size="20" value="<?=htmlspecialchars($pconfig['dns2']);?>"><br>
589
				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.
590
			</td>
591
			</tr>
592
			<tr>
593
			<td width="22%" valign="top" class="vncell">Gateway</td>
594
			<td width="78%" class="vtable">
595
				<input name="gateway" type="text" class="formfld host" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>"><br>
596
			 	 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.
597
			</td>
598
			</tr>
599
			<tr>
600
			<td width="22%" valign="top" class="vncell">Domain name</td>
601
			<td width="78%" class="vtable">
602
				<input name="domain" type="text" class="formfld unknown" id="domain" size="20" value="<?=htmlspecialchars($pconfig['domain']);?>"><br>
603
				 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.
604
			 </td>
605
			</tr>
606
			<tr>
607
			<td width="22%" valign="top" class="vncell">Domain search list</td>
608
			<td width="78%" class="vtable">
609
				<input name="domainsearchlist" type="text" class="formfld unknown" id="domainsearchlist" size="20" value="<?=htmlspecialchars($pconfig['domainsearchlist']);?>"><br>
610
				The DHCP server can optionally provide a domain search list.
611
			</td>
612
			</tr>
613
			<tr>
614
			<td width="22%" valign="top" class="vncell">Default lease time</td>
615
			<td width="78%" class="vtable">
616
				<input name="deftime" type="text" class="formfld unknown" id="deftime" size="10" value="<?=htmlspecialchars($pconfig['deftime']);?>">
617
				seconds<br>
618
				This is used for clients that do not ask for a specific
619
				expiration time.<br>
620
				The default is 7200 seconds.
621
			</td>
622
			</tr>
623
			<tr>
624
			<td width="22%" valign="top" class="vncell">Maximum lease time</td>
625
			<td width="78%" class="vtable">
626
				<input name="maxtime" type="text" class="formfld unknown" id="maxtime" size="10" value="<?=htmlspecialchars($pconfig['maxtime']);?>">
627
				seconds<br>
628
				This is the maximum lease time for clients that ask
629
				for a specific expiration time.<br>
630
				The default is 86400 seconds.
631
			</td>
632
			</tr>
633
			<tr>
634
			<td width="22%" valign="top" class="vncell">Failover peer IP:</td>
635
			<td width="78%" class="vtable">
636 636
				<input name="failover_peerip" type="text" class="formfld host" id="failover_peerip" size="20" value="<?=htmlspecialchars($pconfig['failover_peerip']);?>"><br>
637 637
				Leave blank to disable.  Enter the interface IP address of the other machine.  Machines must be using CARP.
638 638
			</td>
639 639
			</tr>
640 640
			<tr>
641
				<td width="22%" valign="top" class="vncell">
642
					Static ARP
643
				</td>
644
				<td width="78%" class="vtable">
645
					<table>
646
						<tr>
647
							<td>
648
								<input valign="middle" type="checkbox" value="yes" name="staticarp" id="staticarp" <?php if($pconfig['staticarp']) echo " checked"; ?>>&nbsp;
649
							</td>
650
							<td>
651
								<b>Enable Static ARP entries</b>
652
							</td>
653
						</tr>
654
						<tr>
655
							<td>
656
								&nbsp;
657
							</td>
658
							<td>
659
								<span class="red"><strong>Note:</strong></span> Only the machines listed below will be able to communicate with the firewall on this NIC.
660
							</td>
661
						</tr>
662
					</table>
663
				</td>
641
			<td width="22%" valign="top" class="vncell">Static ARP</td>
642
			<td width="78%" class="vtable">
643
				<table>
644
					<tr>
645
					<td>
646
						<input valign="middle" type="checkbox" value="yes" name="staticarp" id="staticarp" <?php if($pconfig['staticarp']) echo " checked"; ?>>&nbsp;
647
					</td>
648
					<td><b>Enable Static ARP entries</b></td>
649
					</tr>
650
					<tr>
651
					<td>&nbsp;</td>
652
					<td>
653
						<span class="red"><strong>Note:</strong></span> Only the machines listed below will be able to communicate with the firewall on this NIC.
654
					</td>
655
					</tr>
656
				</table>
657
			</td>
664 658
			</tr>
665 659
			<tr>
666
				<td width="22%" valign="top" class="vncell">
667
					Dynamic DNS
668
				</td>
669
				<td width="78%" class="vtable">
670
					<div id="showddnsbox">
671
						<input type="button" onClick="show_ddns_config()" value="Advanced"></input> - Show Dynamic DNS</a>
672
					</div>
673
					<div id="showddns" style="display:none">
674
						<input valign="middle" type="checkbox" value="yes" name="ddnsupdate" id="ddnsupdate" <?php if($pconfig['ddnsupdate']) echo " checked"; ?>>&nbsp;
675
						<b>Enable registration of DHCP client names in DNS.</b><br />
676
						<p>
677
						<input name="ddnsdomain" type="text" class="formfld unknown" id="ddnsdomain" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomain']);?>"><br />
678
						Note: Leave blank to disable dynamic DNS registration.<br />
679
						Enter the dynamic DNS domain which will be used to register client names in the DNS server.
680
					</div>
681
				</td>
682
		      </tr>
660
			<td width="22%" valign="top" class="vncell">Dynamic DNS</td>
661
			<td width="78%" class="vtable">
662
				<div id="showddnsbox">
663
					<input type="button" onClick="show_ddns_config()" value="Advanced"></input> - Show Dynamic DNS</a>
664
				</div>
665
				<div id="showddns" style="display:none">
666
					<input valign="middle" type="checkbox" value="yes" name="ddnsupdate" id="ddnsupdate" <?php if($pconfig['ddnsupdate']) echo " checked"; ?>>&nbsp;
667
					<b>Enable registration of DHCP client names in DNS.</b><br />
668
					<p>
669
					<input name="ddnsdomain" type="text" class="formfld unknown" id="ddnsdomain" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomain']);?>"><br />
670
					Note: Leave blank to disable dynamic DNS registration.<br />
671
					Enter the dynamic DNS domain which will be used to register client names in the DNS server.
672
				</div>
673
			</td>
674
			</tr>
683 675
			<tr>
684
				<td width="22%" valign="top" class="vncell">NTP servers</td>
685
				<td width="78%" class="vtable">
676
			<td width="22%" valign="top" class="vncell">NTP servers</td>
677
			<td width="78%" class="vtable">
686 678
				<div id="showntpbox">
687 679
					<input type="button" onClick="show_ntp_config()" value="Advanced"></input> - Show NTP configuration</a>
688 680
				</div>
......
693 685
			</td>
694 686
			</tr>
695 687
			<tr>
696
				<td width="22%" valign="top" class="vncell">
697
					TFTP server
698
				</td>
699
				<td width="78%" class="vtable">
700
				<div id="showtftpbox">
701
					<input type="button" onClick="show_tftp_config()" value="Advanced"></input> - Show TFTP configuration</a>
702
				</div>
703
				<div id="showtftp" style="display:none">
704
					<input name="tftp" type="text" class="formfld unknown" id="tftp" size="50" value="<?=htmlspecialchars($pconfig['tftp']);?>"><br>
705
					Leave blank to disable.  Enter a full hostname or IP for the TFTP server.
706
				</div>
688
			<td width="22%" valign="top" class="vncell">TFTP server</td>
689
			<td width="78%" class="vtable">
690
			<div id="showtftpbox">
691
				<input type="button" onClick="show_tftp_config()" value="Advanced"></input> - Show TFTP configuration</a>
692
			</div>
693
			<div id="showtftp" style="display:none">
694
				<input name="tftp" type="text" class="formfld unknown" id="tftp" size="50" value="<?=htmlspecialchars($pconfig['tftp']);?>"><br>
695
				Leave blank to disable.  Enter a full hostname or IP for the TFTP server.
696
			</div>
707 697
			</td>
708 698
			</tr>
709 699
			<tr>
710
				<td width="22%" valign="top" class="vncell">LDAP URI</td>
711
					<td width="78%" class="vtable">
712
						<div id="showldapbox">
713
							<input type="button" onClick="show_ldap_config()" value="Advanced"></input> - Show LDAP configuration</a>
714
						</div>
715
						<div id="showldap" style="display:none">
716
							<input name="ldap" type="text" class="formfld unknown" id="ldap" size="80" value="<?=htmlspecialchars($pconfig['ldap']);?>"><br>
717
							Leave blank to disable.  Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com
718
						</div>
719
					</td>
700
			<td width="22%" valign="top" class="vncell">LDAP URI</td>
701
			<td width="78%" class="vtable">
702
				<div id="showldapbox">
703
					<input type="button" onClick="show_ldap_config()" value="Advanced"></input> - Show LDAP configuration</a>
704
				</div>
705
				<div id="showldap" style="display:none">
706
					<input name="ldap" type="text" class="formfld unknown" id="ldap" size="80" value="<?=htmlspecialchars($pconfig['ldap']);?>"><br>
707
					Leave blank to disable.  Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com
708
				</div>
709
			</td>
720 710
			</tr>
721 711
			<tr>
722
				<td width="22%" valign="top" class="vncell">Enable network booting</td>
723
				<td width="78%" class="vtable">
724
					<div id="shownetbootbox">
725
						<input type="button" onClick="show_netboot_config()" value="Advanced"></input> - Show Network booting</a>
726
					</div>
727
					<div id="shownetboot" style="display:none">
728
						<input valign="middle" type="checkbox" value="yes" name="netboot" id="netboot" <?php if($pconfig['netboot']) echo " checked"; ?>>&nbsp;
729
						<b>Enables network booting.</b>
730
						<p>
731
						Enter the IP of the <b>next-server</b>
732
						<input name="nextserver" type="text" class="formfld unknown" id="nextserver" size="20" value="<?=htmlspecialchars($pconfig['nextserver']);?>">
733
						and the filename					
734
						<input name="filename" type="text" class="formfld unknown" id="filename" size="20" value="<?=htmlspecialchars($pconfig['filename']);?>"><br>
735
						Note: You need both a filename and a boot server configured for this to work!
736
					  	<p>
737
						Enter the <b>root-path</b>-string
738
	          			<input name="rootpath" type="text" class="formfld unknown" id="rootpath" size="90" value="<?=htmlspecialchars($pconfig['rootpath']);?>"><br>
739
	          			Note: string-format: iscsi:(servername):(protocol):(port):(LUN):targetname
740
        			</div>
712
			<td width="22%" valign="top" class="vncell">Enable network booting</td>
713
			<td width="78%" class="vtable">
714
				<div id="shownetbootbox">
715
					<input type="button" onClick="show_netboot_config()" value="Advanced"></input> - Show Network booting</a>
716
				</div>
717
				<div id="shownetboot" style="display:none">
718
					<input valign="middle" type="checkbox" value="yes" name="netboot" id="netboot" <?php if($pconfig['netboot']) echo " checked"; ?>>&nbsp;
719
					<b>Enables network booting.</b>
720
					<p>
721
					Enter the IP of the <b>next-server</b>
722
					<input name="nextserver" type="text" class="formfld unknown" id="nextserver" size="20" value="<?=htmlspecialchars($pconfig['nextserver']);?>">
723
					and the filename
724
					<input name="filename" type="text" class="formfld unknown" id="filename" size="20" value="<?=htmlspecialchars($pconfig['filename']);?>"><br>
725
					Note: You need both a filename and a boot server configured for this to work!
726
					<p>
727
					Enter the <b>root-path</b>-string
728
					<input name="rootpath" type="text" class="formfld unknown" id="rootpath" size="90" value="<?=htmlspecialchars($pconfig['rootpath']);?>"><br>
729
					Note: string-format: iscsi:(servername):(protocol):(port):(LUN):targetname
730
				</div>
741 731
			</td>
742 732
			</tr>
743 733
			<tr>
744

  
745

  
746
				<td width="22%" valign="top" class="vncell">
747
					Additional BOOTP/DHCP Options
748
				</td>
749
				<td width="78%" class="vtable">
750
					<div id="shownumbervaluebox">
751
						<input type="button" onClick="show_shownumbervalue()" value="Advanced"></input> - Show Additional BOOTP/DHCP Options</a>
734
			<td width="22%" valign="top" class="vncell">Additional BOOTP/DHCP Options</td>
735
			<td width="78%" class="vtable">
736
				<div id="shownumbervaluebox">
737
					<input type="button" onClick="show_shownumbervalue()" value="Advanced"></input> - Show Additional BOOTP/DHCP Options</a>
738
				</div>
739
				<div id="shownumbervalue" style="display:none">
740
				<table id="maintable">
741
				<tbody>
742
				<tr>
743
				<td colspan="3">
744
					<div style="padding:5px; margin-top: 16px; margin-bottom: 16px; border:1px dashed #000066; background-color: #ffffff; color: #000000; font-size: 8pt;" id="itemhelp">
745
					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="_new">URL</a>.
752 746
					</div>
753
					<div id="shownumbervalue" style="display:none">
754
			    <table id="maintable">
755
			        <tbody>
756
			          <tr>
757
			            <td colspan="3">
758
			      		    <div style="padding:5px; margin-top: 16px; margin-bottom: 16px; border:1px dashed #000066; background-color: #ffffff; color: #000000; font-size: 8pt;" id="itemhelp">
759
								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="_new">URL</a>.
760
							</div>
761
			            </td>
762
			          </tr>
763
			          <tr>
764
			            <td><div id="onecolumn">Number</div></td>
765
			            <td><div id="twocolumn">Value</div></td>
766
			          </tr>
747
				</td>
748
				</tr>
749
				<tr>
750
				<td><div id="onecolumn">Number</div></td>
751
				<td><div id="twocolumn">Value</div></td>
752
				</tr>
767 753
				<?php $counter = 0; ?>
768
				<?php 
754
				<?php
769 755
					if($pconfig['numberoptions'])
770
				 		foreach($pconfig['numberoptions']['item'] as $item): 
756
						foreach($pconfig['numberoptions']['item'] as $item):
771 757
				?>
772 758
					<?php
773 759
						$number = $item['number'];
774 760
						$value = $item['value'];
775 761
					?>
776
			          <tr>
777
			            <td>
778
							<input autocomplete="off" name="number<?php echo $counter; ?>" type="text" class="formfld" id="number<?php echo $counter; ?>" size="10" value="<?=htmlspecialchars($number);?>" />
779
			            </td>
780
			            <td>
781
							<input autocomplete="off" name="value<?php echo $counter; ?>" type="text" class="formfld" id="value<?php echo $counter; ?>" size="55" value="<?=htmlspecialchars($value);?>" />
782
						</td>
783
			            <td>
784
			    		<input type="image" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" onclick="removeRow(this); return false;" value="Delete" />
785
				      </td>
786
			          </tr>
762
				<tr>
763
				<td>
764
					<input autocomplete="off" name="number<?php echo $counter; ?>" type="text" class="formfld" id="number<?php echo $counter; ?>" size="10" value="<?=htmlspecialchars($number);?>" />
765
				</td>
766
				<td>
767
					<input autocomplete="off" name="value<?php echo $counter; ?>" type="text" class="formfld" id="value<?php echo $counter; ?>" size="55" value="<?=htmlspecialchars($value);?>" />
768
				</td>
769
				<td>
770
					<input type="image" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" onclick="removeRow(this); return false;" value="Delete" />
771
				</td>
772
				</tr>
787 773
				<?php $counter++; ?>
788 774
				<?php endforeach; ?>
789
			        </tbody>
790
			        <tfoot>
791
			        </tfoot>
775
				</tbody>
776
				<tfoot>
777
				</tfoot>
792 778
				</table>
793 779
				<a onclick="javascript:addRowTo('maintable', 'formfldalias'); return false;" href="#">
794 780
					<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="add another entry" />
......
803 789

  
804 790
				</td>
805 791
			</tr>
806
            <tr>
807
              <td width="22%" valign="top">&nbsp;</td>
808
              <td width="78%">
809
                <input name="if" type="hidden" value="<?=$if;?>">
810
                <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
811
              </td>
812
            </tr>
813 792
			<tr>
814
				<td width="22%" valign="top">&nbsp;</td>
815
				<td width="78%"> <p><span class="vexpl"><span class="red"><strong>Note:<br>
816
					</strong></span>The DNS servers entered in <a href="system.php">System:
817
					General setup</a> (or the <a href="services_dnsmasq.php">DNS
818
					forwarder</a>, if enabled) </span><span class="vexpl">will
819
					be assigned to clients by the DHCP server.<br>
820
					<br>
821
					The DHCP lease table can be viewed on the <a href="diag_dhcp_leases.php">Status:
822
					DHCP leases</a> page.<br>
823
					</span></p>
824
				</td>
793
			<td width="22%" valign="top">&nbsp;</td>
794
			<td width="78%">
795
				<input name="if" type="hidden" value="<?=$if;?>">
796
				<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
797
			</td>
798
			</tr>
799
			<tr>
800
			<td width="22%" valign="top">&nbsp;</td>
801
			<td width="78%"> <p><span class="vexpl"><span class="red"><strong>Note:<br>
802
				</strong></span>The DNS servers entered in <a href="system.php">System:
803
				General setup</a> (or the <a href="services_dnsmasq.php">DNS
804
				forwarder</a>, if enabled) </span><span class="vexpl">will
805
				be assigned to clients by the DHCP server.<br>
806
				<br>
807
				The DHCP lease table can be viewed on the <a href="diag_dhcp_leases.php">Status:
808
				DHCP leases</a> page.<br>
809
				</span></p>
810
			</td>
825 811
			</tr>
826 812
		</table>
827 813
		<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
......
832 818
			<td width="30%" class="listhdr">Description</td>
833 819
			<td width="10%" class="list">
834 820
			<table border="0" cellspacing="0" cellpadding="1">
835
		<tr>
821
			<tr>
836 822
			<td valign="middle" width="17"></td>
837 823
			<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>
838 824
			</tr>
839 825
			</table>
840 826
			</td>
841 827
		</tr>
842
			  <?php if(is_array($a_maps)): ?>
843
			  <?php $i = 0; foreach ($a_maps as $mapent): ?>
844
			  <?php if($mapent['mac'] <> "" or $mapent['ipaddr'] <> ""): ?>
845
                <tr>
846
                  <td class="listlr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
847
                    <?=htmlspecialchars($mapent['mac']);?>
848
                  </td>
849
                  <td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
850
                    <?=htmlspecialchars($mapent['ipaddr']);?>&nbsp;
851
                  </td>
852
                  <td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
853
                    <?=htmlspecialchars($mapent['hostname']);?>&nbsp;
854
                  </td>	
855
                  <td class="listbg" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
856
                    <?=htmlspecialchars($mapent['descr']);?>&nbsp;
857
                  </td>
858
                  <td valign="middle" nowrap class="list">
859
                    <table border="0" cellspacing="0" cellpadding="1">
860
                      <tr>
861
                        <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>
862
                        <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>
863
                      </tr>
864
                    </table>
865
                  </td>
866
                </tr>
828
			<?php if(is_array($a_maps)): ?>
829
			<?php $i = 0; foreach ($a_maps as $mapent): ?>
830
			<?php if($mapent['mac'] <> "" or $mapent['ipaddr'] <> ""): ?>
831
		<tr>
832
		<td class="listlr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
833
			<?=htmlspecialchars($mapent['mac']);?>
834
		</td>
835
		<td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
836
			<?=htmlspecialchars($mapent['ipaddr']);?>&nbsp;
837
		</td>
838
		<td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
839
			<?=htmlspecialchars($mapent['hostname']);?>&nbsp;
840
		</td>
841
		<td class="listbg" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';">
842
			<?=htmlspecialchars($mapent['descr']);?>&nbsp;
843
		</td>
844
		<td valign="middle" nowrap class="list">
845
			<table border="0" cellspacing="0" cellpadding="1">
846
			<tr>
847
			<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>
848
			<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>
849
			</tr>
850
			</table>
851
		</td>
852
		</tr>
867 853
		<?php endif; ?>
868 854
		<?php $i++; endforeach; ?>
869 855
		<?php endif; ?>
870
                <tr>
871
                  <td class="list" colspan="4"></td>
872
                  <td class="list">
873
                    <table border="0" cellspacing="0" cellpadding="1">
874
                      <tr>
856
		<tr>
857
		<td class="list" colspan="4"></td>
858
		<td class="list">
859
			<table border="0" cellspacing="0" cellpadding="1">
860
			<tr>
875 861
			<td valign="middle" width="17"></td>
876
                        <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>
877
                      </tr>
878
                    </table>
879
                  </td>
880
                </tr>
881
              </table>
862
			<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>
863
			</tr>
864
			</table>
865
		</td>
866
		</tr>
867
		</table>
882 868
	</div>
883
    </td>
884
  </tr>
869
</td>
870
</tr>
885 871
</table>
886 872
</form>
887 873
<script language="JavaScript">

Also available in: Unified diff