From de792e62e30ac90d0d5d96f119681c86836a366f Mon Sep 17 00:00:00 2001 From: jim-p Date: Fri, 21 May 2010 13:45:24 -0400 Subject: Fix whitespace while I'm here. --- usr/local/www/services_dhcp.php | 666 ++++++++++++++++++++-------------------- 1 file changed, 326 insertions(+), 340 deletions(-) (limited to 'usr/local/www/services_dhcp.php') diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php index 0a9bb46..0bbb3bc 100755 --- a/usr/local/www/services_dhcp.php +++ b/usr/local/www/services_dhcp.php @@ -47,7 +47,7 @@ if(!$g['services_dhcp_server_enable']) { exit; } -/* Fix failover DHCP problem +/* Fix failover DHCP problem * http://article.gmane.org/gmane.comp.security.firewalls.pfsense.support/18749 */ ini_set("memory_limit","64M"); @@ -120,8 +120,8 @@ $iflist = get_configured_interface_with_descr(); /* set the starting interface */ if (!$if || !isset($iflist[$if])) { foreach ($iflist as $ifent => $ifname) { - $oc = $config['interfaces'][$ifent]; - if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddr($oc['ipaddr']))) || + $oc = $config['interfaces'][$ifent]; + if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddr($oc['ipaddr']))) || (!is_array($config['dhcpd'][$ifent]) && (!is_ipaddr($oc['ipaddr'])))) continue; $if = $ifent; @@ -133,7 +133,7 @@ if (is_array($config['dhcpd'][$if])){ if (is_array($config['dhcpd'][$if]['range'])) { $pconfig['range_from'] = $config['dhcpd'][$if]['range']['from']; $pconfig['range_to'] = $config['dhcpd'][$if]['range']['to']; - } + } $pconfig['deftime'] = $config['dhcpd'][$if]['defaultleasetime']; $pconfig['maxtime'] = $config['dhcpd'][$if]['maxleasetime']; $pconfig['gateway'] = $config['dhcpd'][$if]['gateway']; @@ -156,8 +156,8 @@ if (is_array($config['dhcpd'][$if])){ $pconfig['failover_peerip'] = $config['dhcpd'][$if]['failover_peerip']; $pconfig['netmask'] = $config['dhcpd'][$if]['netmask']; $pconfig['numberoptions'] = $config['dhcpd'][$if]['numberoptions']; - if (!is_array($config['dhcpd'][$if]['staticmap'])) - $config['dhcpd'][$if]['staticmap'] = array(); + if (!is_array($config['dhcpd'][$if]['staticmap'])) + $config['dhcpd'][$if]['staticmap'] = array(); $a_maps = &$config['dhcpd'][$if]['staticmap']; } @@ -165,7 +165,7 @@ $ifcfgip = get_interface_ip($if); $ifcfgsn = get_interface_subnet($if); /* set the enabled flag which will tell us if DHCP relay is enabled - * on any interface. We will use this to disable DHCP server since + * on any interface. We will use this to disable DHCP server since * the two are not compatible with each other. */ @@ -211,31 +211,31 @@ if ($_POST) { $reqdfieldsn = explode(",", "Range begin,Range end"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); - - if (($_POST['range_from'] && !is_ipaddr($_POST['range_from']))) + + if (($_POST['range_from'] && !is_ipaddr($_POST['range_from']))) $input_errors[] = "A valid range must be specified."; - if (($_POST['range_to'] && !is_ipaddr($_POST['range_to']))) + if (($_POST['range_to'] && !is_ipaddr($_POST['range_to']))) $input_errors[] = "A valid range must be specified."; - if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) + if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) $input_errors[] = "A valid IP address must be specified for the gateway."; - if (($_POST['wins1'] && !is_ipaddr($_POST['wins1'])) || ($_POST['wins2'] && !is_ipaddr($_POST['wins2']))) + if (($_POST['wins1'] && !is_ipaddr($_POST['wins1'])) || ($_POST['wins2'] && !is_ipaddr($_POST['wins2']))) $input_errors[] = "A valid IP address must be specified for the primary/secondary WINS servers."; - if (($_POST['dns1'] && !is_ipaddr($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddr($_POST['dns2']))) + if (($_POST['dns1'] && !is_ipaddr($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddr($_POST['dns2']))) $input_errors[] = "A valid IP address must be specified for the primary/secondary DNS servers."; - if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60))) + if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60))) $input_errors[] = "The default lease time must be at least 60 seconds."; - if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime']))) + if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime']))) $input_errors[] = "The maximum lease time must be at least 60 seconds and higher than the default lease time."; - if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain']))) + if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain']))) $input_errors[] = "A valid domain name must be specified for the dynamic DNS registration."; - if (($_POST['ntp1'] && !is_ipaddr($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddr($_POST['ntp2']))) + if (($_POST['ntp1'] && !is_ipaddr($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddr($_POST['ntp2']))) $input_errors[] = "A valid IP address must be specified for the primary/secondary NTP servers."; if (($_POST['domain'] && !is_domain($_POST['domain']))) $input_errors[] = "A valid domain name must be specified for the DNS domain."; if (($_POST['tftp'] && (!is_ipaddr($_POST['tftp']) && !is_domain($_POST['tftp'])))) $input_errors[] = "A valid IP address or hostname must be specified for the TFTP server."; - if (($_POST['nextserver'] && !is_ipaddr($_POST['nextserver']))) + if (($_POST['nextserver'] && !is_ipaddr($_POST['nextserver']))) $input_errors[] = "A valid IP address must be specified for the network boot server."; if(gen_subnet($ifcfgip, $ifcfgsn) == $_POST['range_from']) @@ -246,8 +246,8 @@ if ($_POST) { // Disallow a range that includes the virtualip if (is_array($config['virtualip']['vip'])) { foreach($config['virtualip']['vip'] as $vip) { - if($vip['interface'] == $if) - if($vip['subnet'] && is_inrange($vip['subnet'], $_POST['range_from'], $_POST['range_to'])) + if($vip['interface'] == $if) + if($vip['subnet'] && is_inrange($vip['subnet'], $_POST['range_from'], $_POST['range_to'])) $input_errors[] = "The subnet range cannot overlap with virtual IP address {$vip['subnet']}."; } } @@ -283,7 +283,7 @@ if ($_POST) { $config['dhcpd'][$if]['maxleasetime'] = $_POST['maxtime']; $config['dhcpd'][$if]['netmask'] = $_POST['netmask']; $previous = $config['dhcpd'][$if]['failover_peerip']; - if($previous <> $_POST['failover_peerip']) + if($previous <> $_POST['failover_peerip']) mwexec("/bin/rm -rf /var/dhcpd/var/db/*"); $config['dhcpd'][$if]['failover_peerip'] = $_POST['failover_peerip']; @@ -346,12 +346,12 @@ if ($_POST) { if ($retvaldns == 0) { clear_subsystem_dirty('hosts'); clear_subsystem_dirty('staticmaps'); - } + } } else { - $retvaldhcp = services_dhcpd_configure(); + $retvaldhcp = services_dhcpd_configure(); if ($retvaldhcp == 0) clear_subsystem_dirty('staticmaps'); - } + } if($retvaldhcp == 1 || $retvaldns == 1) $retval = 1; $savemsg = get_std_save_message($retval); @@ -461,10 +461,10 @@ include("head.inc");
-"; echo ""; exit; @@ -474,15 +474,15 @@ include("head.inc"); You must apply the changes in order for them to take effect.");?>
- - - + +
- + $ifname) { - $oc = $config['interfaces'][$ifent]; - if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddr($oc['ipaddr']))) || + $oc = $config['interfaces'][$ifent]; + if ((is_array($config['dhcpd'][$ifent]) && !isset($config['dhcpd'][$ifent]['enable']) && (!is_ipaddr($oc['ipaddr']))) || (!is_array($config['dhcpd'][$ifent]) && (!is_ipaddr($oc['ipaddr'])))) continue; if ($ifent == $if) @@ -500,189 +500,181 @@ include("head.inc"); exit; } display_top_tabs($tab_array); - ?> -
+?> +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
  - onClick="enable_change(false)"> - Enable DHCP server on - - interface
  - > - Deny unknown clients
- If this is checked, only the clients defined below will get DHCP leases from this server.
Subnet - -
Subnet mask - -
Available range - - - - -
Subnet Mask - -
Range - -  to  -
WINS servers -
- -
DNS servers -
-
- 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. -
Gateway -
- 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. -
Domain name -
- 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. -
Domain search list -
- The DHCP server can optionally provide a domain search list. -
Default lease time - - seconds
- This is used for clients that do not ask for a specific - expiration time.
- The default is 7200 seconds. -
Maximum lease time - - seconds
- This is the maximum lease time for clients that ask - for a specific expiration time.
- The default is 86400 seconds. -
Failover peer IP: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - + - - + - - + + - - + - - - - + + +
  + onClick="enable_change(false)"> + Enable DHCP server on + + interface
  + > + Deny unknown clients
+ If this is checked, only the clients defined below will get DHCP leases from this server.
Subnet + +
Subnet mask + +
Available range + + - + +
Subnet Mask + +
Range + +  to  +
WINS servers +
+ +
DNS servers +
+
+ 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. +
Gateway +
+ 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. +
Domain name +
+ 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. +
Domain search list +
+ The DHCP server can optionally provide a domain search list. +
Default lease time + + seconds
+ This is used for clients that do not ask for a specific + expiration time.
+ The default is 7200 seconds. +
Maximum lease time + + seconds
+ This is the maximum lease time for clients that ask + for a specific expiration time.
+ The default is 86400 seconds. +
Failover peer IP:
Leave blank to disable. Enter the interface IP address of the other machine. Machines must be using CARP.
- Static ARP - - - - - - - - - - -
- >  - - Enable Static ARP entries -
-   - - Note: Only the machines listed below will be able to communicate with the firewall on this NIC. -
-
Static ARP + + + + + + + + + +
+ >  + Enable Static ARP entries
  + Note: Only the machines listed below will be able to communicate with the firewall on this NIC. +
+
- Dynamic DNS - -
- - Show Dynamic DNS -
- -
Dynamic DNS +
+ - Show Dynamic DNS +
+ +
NTP servers + NTP servers
- Show NTP configuration
@@ -693,102 +685,96 @@ include("head.inc");
- TFTP server - -
- - Show TFTP configuration -
- +
TFTP server +
+ - Show TFTP configuration +
+
LDAP URI -
- - Show LDAP configuration -
- -
LDAP URI +
+ - Show LDAP configuration +
+ +
Enable network booting -
- - Show Network booting -
- +
Enable network booting +
+ - Show Network booting +
+
- Additional BOOTP/DHCP Options - -
- - Show Additional BOOTP/DHCP Options +
Additional BOOTP/DHCP Options +
+ - Show Additional BOOTP/DHCP Options +
+
-