diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-01-31 06:16:55 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-01-31 06:16:55 +0000 |
commit | de3fa7a651b48ed49f482058bab5dfd5c76947e2 (patch) | |
tree | 9e69b458d3f2fde66e38457b09d442801b7f59ff /usr/local | |
parent | a78ca285722cadfbcd30923be19a685506e93145 (diff) | |
download | pfsense-de3fa7a651b48ed49f482058bab5dfd5c76947e2.zip pfsense-de3fa7a651b48ed49f482058bab5dfd5c76947e2.tar.gz |
m0n0wall -> pfSense
Diffstat (limited to 'usr/local')
-rwxr-xr-x | usr/local/www/services_dhcp_relay.php | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/usr/local/www/services_dhcp_relay.php b/usr/local/www/services_dhcp_relay.php index 674077c..9895073 100755 --- a/usr/local/www/services_dhcp_relay.php +++ b/usr/local/www/services_dhcp_relay.php @@ -1,22 +1,22 @@ #!/usr/local/bin/php -<?php +<?php /* services_dhcp.php part of m0n0wall (http://m0n0.ch/wall) - + Copyright (C) 2003-2004 Justin Ellison <justin@techadvise.com>. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -46,7 +46,7 @@ function get_wan_dhcp_server() { if ($iface == $config['interfaces']['wan'] && isset($dhcpserver)) { break; } - } + } return $dhcpserver[1]; } @@ -56,12 +56,12 @@ require("guiconfig.inc"); $if = $_GET['if']; if ($_POST['if']) $if = $_POST['if']; - + $iflist = array("lan" => "LAN"); for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) { $oc = $config['interfaces']['opt' . $i]; - + if (isset($oc['enable']) && $oc['if'] && (!$oc['bridge'])) { $iflist['opt' . $i] = $oc['descr']; } @@ -89,29 +89,29 @@ if ($_POST) { $_POST['server'] = get_wan_dhcp_server(); $reqdfields = explode(" ", "server"); $reqdfieldsn = explode(",", "Destination Server"); - + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); - - if (($_POST['server'] && !is_ipaddr($_POST['server']))) + + if (($_POST['server'] && !is_ipaddr($_POST['server']))) $input_errors[] = "A valid Destination Server IP address must be specified."; - + if (!$input_errors) { /* make sure that the DHCP server isn't enabled on this interface */ - if (isset($config['dhcpd'][$if]['enable'])) + if (isset($config['dhcpd'][$if]['enable'])) $input_errors[] = "You must disable the DHCP server on the {$iflist[$if]} interface before enabling the DHCP Relay."; /* make sure that the DHCP server isn't running on any of the implied interfaces */ foreach ($config['interfaces'] as $ifname => $ifcfg) { $subnet = $ifcfg['ipaddr'] . "/" . $ifcfg['subnet']; - if (ip_in_subnet($_POST['server'],$subnet)) - $destif = $ifname; - } - if (!isset($destif)) + if (ip_in_subnet($_POST['server'],$subnet)) + $destif = $ifname; + } + if (!isset($destif)) $destif = "wan"; - if (isset($config['dhcpd'][$destif]['enable'])) + if (isset($config['dhcpd'][$destif]['enable'])) $input_errors[] = "You must disable the DHCP server on the {$destif} interface before enabling the DHCP Relay."; - + /* if proxydhcp is selected, make sure DHCP is enabled on WAN */ - if (isset($config['dhcrelay']['proxydhcp']) && $config['interfaces']['wan']['ipaddr'] != "dhcp") + if (isset($config['dhcrelay']['proxydhcp']) && $config['interfaces']['wan']['ipaddr'] != "dhcp") $input_errors[] = "You must have DHCP active on the WAN interface before enabling the DHCP proxy option."; } } @@ -121,9 +121,9 @@ if ($_POST) { $config['dhcrelay']['proxydhcp'] = $_POST['proxydhcp'] ? true : false; $config['dhcrelay']['server'] = $_POST['server']; $config['dhcrelay'][$if]['enable'] = $_POST['enable'] ? true : false; - + write_config(); - + $retval = 0; if (!file_exists($d_sysrebootreqd_path)) { config_lock(); @@ -131,7 +131,7 @@ if ($_POST) { config_unlock(); } $savemsg = get_std_save_message($retval); - + } } @@ -180,14 +180,14 @@ function enable_change(enable_over) { <?php endforeach; ?> </ul> </td></tr> - <tr> - <td class="tabcont"> + <tr> + <td class="tabcont"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> + <tr> <td width="22%" valign="top" class="vtable"> </td> <td width="78%" class="vtable"> <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)"> - <strong>Enable DHCP relay on + <strong>Enable DHCP relay on <?=htmlspecialchars($iflist[$if]);?> interface</strong></td> </tr> @@ -196,22 +196,22 @@ function enable_change(enable_over) { <td width="78%" class="vtable"> <input name="agentoption" type="checkbox" value="yes" <?php if ($pconfig['agentoption']) echo "checked"; ?>> <strong>Append circuit ID and agent ID to requests</strong><br> - If this is checked, the DHCP relay will append the circuit ID (m0n0wall interface number) and the agent ID to the DHCP request.</td> + If this is checked, the DHCP relay will append the circuit ID (pfSense interface number) and the agent ID to the DHCP request.</td> </tr> - <tr> + <tr> <td width="22%" valign="top" class="vncell">Destination server</td> - <td width="78%" class="vtable"> + <td width="78%" class="vtable"> <input name="proxydhcp" type="checkbox" value="yes" <?php if ($pconfig['proxydhcp']) echo "checked"; ?> onClick="enable_change(false)"> Proxy requests to DHCP server on WAN subnet <br><br><input name="server" type="text" class="formfld" id="server" size="20" value="<?=htmlspecialchars($pconfig['server']);?>"> <br> This is the IP address of the server to which the DHCP packet is relayed. Select "Proxy requests to DHCP server on WAN subnet" to relay DHCP packets to the server that was used on the WAN interface. </td> </tr> - <tr> + <tr> <td width="22%" valign="top"> </td> - <td width="78%"> - <input name="if" type="hidden" value="<?=$if;?>"> - <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)"> + <td width="78%"> + <input name="if" type="hidden" value="<?=$if;?>"> + <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)"> </td> </tr> </table> |