@@ -81,175 +87,197 @@ function dhcp_clean_leases() {
...
@@ -81,175 +87,197 @@ function dhcp_clean_leases() {
fclose($fd);
fclose($fd);
}
}
$if=$_GET['if'];
functionvalidate_partial_mac_list($maclist){
if(!empty($_POST['if']))
$macs=explode(',',$maclist);
$if=$_POST['if'];
// Loop through and look for invalid MACs.
foreach($macsas$mac){
if(!$_GET['if'])
if(!is_macaddr($mac,true)){
$savemsg=gettext("The DHCP Server can only be enabled on interfaces configured with static IP addresses").".<br/><br/>".gettext("Only interfaces configured with a static IP will be shown").".";
$savemsg=gettext("The DHCP Server can only be enabled on interfaces configured with static IP addresses").".<br/><br/>".gettext("Only interfaces configured with a static IP will be shown").".";
// If we have a pool but no interface name, that's not valid. Redirect away.
if(is_numeric($pool)&&empty($if)){
header("Location: services_dhcp.php");
exit;
}
}
if(!is_array($config['dhcpd'][$if]['pool']))
if(empty($config['dhcpd'][$if])){
$config['dhcpd'][$if]=array();
}
if(empty($config['dhcpd'][$if]['pool'])){
$config['dhcpd'][$if]['pool']=array();
$config['dhcpd'][$if]['pool']=array();
}
$a_pools=&$config['dhcpd'][$if]['pool'];
$a_pools=&$config['dhcpd'][$if]['pool'];
if(is_numeric($pool)&&$a_pools[$pool])
if(!empty($_GET['act'])){
$act=$_GET['act'];
}else{
$act=null;
}
/* If no interface is provided, choose first one from interfaces */
$input_errors[]=sprintf(gettext("The subnet range cannot overlap with virtual IP address %s."),$vip['subnet']);
$input_errors[]=sprintf(gettext("The subnet range cannot overlap with virtual IP address %s."),$vip['subnet']);
}
}
}
}
}
}
if(!empty($config['dhcpd'][$if]['staticmap'])){
$a_maps=&$config['dhcpd'][$if]['staticmap'];
}else{
$a_maps=array();
}
$noip=false;
$noip=false;
if(is_array($a_maps))
foreach($a_mapsas$map){
foreach($a_mapsas$map)
if(empty($map['ipaddr'])){
if(empty($map['ipaddr']))
$noip=true;
$noip=true;
if($_POST['staticarp']&&$noip)
}
}
if(!empty($pconfig['staticarp'])&&$noip){
$input_errors[]=gettext("Cannot enable static ARP when you have static map entries without IP addresses. Ensure all static maps have IP addresses and try again.");
$input_errors[]=gettext("Cannot enable static ARP when you have static map entries without IP addresses. Ensure all static maps have IP addresses and try again.");
$input_errors[]=gettext("String type must be enclosed in quotes like \"this\" or must be a series of octets specified in hexadecimal, separated by colons, like 01:23:45:67:89:ab:cd:ef");
$input_errors[]=gettext("String type must be enclosed in quotes like \"this\" or must be a series of octets specified in hexadecimal, separated by colons, like 01:23:45:67:89:ab:cd:ef");
<?phpprint_info_box_apply(gettext("The static mapping configuration has been changed").".<br />".gettext("You must apply the changes in order for them to take effect."));?><br/>
<?phpprint_info_box_apply(gettext("The static mapping configuration has been changed").".<br />".gettext("You must apply the changes in order for them to take effect."));?><br/>
<?phpechogettext("DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.");?>
<?phpprint_info_box(gettext("DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface."));?>
<?phpelseif(count($tab_array)==0):?>
<?phpprint_info_box(("No interfaces found with a static IPv4 address."));?>
<strong><?phpprintf(gettext("Enable DHCP server on ".
<strong><?phpprintf(gettext("Enable DHCP server on "."%s "."interface"),!empty($config['interfaces'][$if]['descr'])?htmlspecialchars($config['interfaces'][$if]['descr']):strtoupper($if));?></strong>
<ahref="services_dhcp.php?if=<?=htmlspecialchars($if);?>&act=delpool&id=<?=$i;?>"onclick="return confirm('<?=gettext("Do you really want to delete this pool?");?>')"><buttontype="button"class="btn btn-xs btn-default"><spanclass="fa fa-trash text-muted"></span></button></a>
<?=gettext("NOTE: leave blank to use the system default DNS servers - this interface's IP if DNS forwarder is enabled, otherwise the servers configured on the General page.");?>
<?=gettext("NOTE: leave blank to use the system default DNS servers - this interface's IP if DNS forwarder is enabled, otherwise the servers configured on the General page.");?>
<?=gettext("The default is to use the IP on this interface of the firewall as the gateway. Specify an alternate gateway here if this is not the correct gateway for your network. Type \"none\" for no gateway assignment.");?>
<?=gettext("The default is to use the IP on this interface of the firewall as the gateway. Specify an alternate gateway here if this is not the correct gateway for your network. Type \"none\" for no gateway assignment.");?>
<?=gettext("The default is to use the domain name of this system as the default domain name provided by DHCP. You may specify an alternate domain name here.");?>
<?=gettext("The default is to use the domain name of this system as the default domain name provided by DHCP. You may specify an alternate domain name here.");?>
<?=gettext("Leave blank to disable. Enter the interface IP address of the other machine. Machines must be using CARP. Interface's advskew determines whether the DHCPd process is Primary or Secondary. Ensure one machine's advskew<20 (and the other is >20).");?>
<?=gettext("Leave blank to disable. Enter the interface IP address of the other machine. Machines must be using CARP. Interface's advskew determines whether the DHCPd process is Primary or Secondary. Ensure one machine's advskew<20 (and the other is >20).");?>
<?=gettext("Warning: This option persists even if DHCP server is disabled. Only the machines listed below will be able to communicate with the firewall on this NIC.");?>
<?=gettext("Warning: This option persists even if DHCP server is disabled. Only the machines listed below will be able to communicate with the firewall on this NIC.");?>
<?=gettext("Enter the DHCP option number and the value for each item you would like to include in the DHCP lease information. For a list of available options please visit this");?><ahref="http://www.iana.org/assignments/bootp-dhcp-parameters/"target="_blank"><?=gettext("URL");?></a>
<?=gettext("Enter the DHCP option number and the value for each item you would like to include in the DHCP lease information. For a list of available options please visit this");?><ahref="http://www.iana.org/assignments/bootp-dhcp-parameters/"target="_blank"><?=gettext("URL");?></a>
<?=sprintf(gettext("The DNS servers entered in %sSystem: ".
<?=sprintf(gettext("The DNS servers entered in %sSystem: ".
"General setup%s (or the %sDNS forwarder%s, if enabled), will be assigned to clients by the DHCP server."),'<a href="system_general.php">','</a>','<a href="services_dnsmasq.php">','</a>');?><br/>
"General setup%s (or the %sDNS forwarder%s, if enabled), will be assigned to clients by the DHCP server."),'<a href="system_general.php">','</a>','<a href="services_dnsmasq.php">','</a>');?><br/>
<tdvalign="middle"><ahref="services_dhcp.php?if=<?=htmlspecialchars($if);?>&act=del&id=<?=$i;?>"onclick="return confirm('<?=gettext("Do you really want to delete this mapping?");?>')"class="btn btn-default btn-xs"><spanclass="fa fa-trash text-muted"></span></a></td>