summaryrefslogtreecommitdiffstats
path: root/usr/local/www/system_gateways_edit.php
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2009-02-15 14:05:30 -0500
committerChris Buechler <cmb@pfsense.org>2009-02-15 14:05:30 -0500
commit87f0be87d22730ab74af8dab0f50bc9196cfdc97 (patch)
treed7afc44efe418fc2f2319a22a69cf56b8d449c95 /usr/local/www/system_gateways_edit.php
parentee01cb054fc3c022b726199b63a69b67751fe860 (diff)
downloadpfsense-87f0be87d22730ab74af8dab0f50bc9196cfdc97.zip
pfsense-87f0be87d22730ab74af8dab0f50bc9196cfdc97.tar.gz
Revert "Merge IPv6 changes"
This reverts commit f193cf92b2c925a2f3f71a713d766efd1e4d81e0.
Diffstat (limited to 'usr/local/www/system_gateways_edit.php')
-rwxr-xr-xusr/local/www/system_gateways_edit.php85
1 files changed, 21 insertions, 64 deletions
diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php
index 314b45d..a8aa571 100755
--- a/usr/local/www/system_gateways_edit.php
+++ b/usr/local/www/system_gateways_edit.php
@@ -38,17 +38,17 @@
require("guiconfig.inc");
-require_once("IPv6.inc");
$a_gateways = return_gateways_array();
+$a_gateways_arr = array();
+foreach($a_gateways as $gw) {
+ $a_gateways_arr[] = $gw;
+}
+$a_gateways = $a_gateways_arr;
-if (isset($_GET['id'])) {
- $id = $_GET['id'];
-} else if (isset($_POST['id'])) {
+$id = $_GET['id'];
+if (isset($_POST['id']))
$id = $_POST['id'];
-} else {
- $id = -1;
-}
if (isset($_GET['dup'])) {
$id = $_GET['dup'];
@@ -62,7 +62,6 @@ if (isset($id) && $a_gateways[$id]) {
$pconfig['monitor'] = $a_gateways[$id]['monitor'];
$pconfig['descr'] = $a_gateways[$id]['descr'];
$pconfig['attribute'] = $a_gateways[$id]['attribute'];
- $pconfig['type'] = $a_gateways[$id]['type'];
}
if (isset($_GET['dup'])) {
@@ -81,33 +80,15 @@ if ($_POST) {
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
- /* Does this gateway name already exist? */
- foreach($config['gateways']['gateway_item'] as $gw)
- if($gw['name'] == $_POST['name'])
- $input_errors[] = "This gateway name already exists.";
-
if (! isset($_POST['name'])) {
$input_errors[] = "A valid gateway name must be specified.";
}
-
- if ($_POST['type'] == 'IPv4') {
- if (!is_ipaddr($_POST['gateway']) && $pconfig['attribute'] != 'system') {
- $input_errors[] = "A valid IPv4 gateway address must be specified.";
- }
-
- if ($_POST['monitor'] && !is_ipaddr($_POST['monitor'])) {
- $input_errors[] = "A valid IPv4 monitor address must be specified.";
- }
- } else if ($_POST['type'] == 'IPv6') {
- if (!Net_IPv6::checkIPv6($_POST['gateway']) && $pconfig['attribute'] != 'system') {
- $input_errors[] = "A valid IPv6 gateway address must be specified.";
- }
-
- if ($_POST['monitor'] && !Net_IPv6::checkIPv6($_POST['monitor'])) {
- $input_errors[] = "A valid IPv6 monitor address must be specified.";
- }
- } else {
- $input_errors[] = "A network type must be specified.";
+ /* skip system gateways which have been automatically added */
+ if ($_POST['gateway'] && (!is_ipaddr($_POST['gateway'])) && ($pconfig['attribute'] != "system")) {
+ $input_errors[] = "A valid gateway IP address must be specified.";
+ }
+ if ((($_POST['monitor'] <> "") && !is_ipaddr($_POST['monitor']))) {
+ $input_errors[] = "A valid monitor IP address must be specified.";
}
/* check for overlaps */
@@ -148,18 +129,16 @@ if ($_POST) {
$gateway['name'] = $_POST['name'];
$gateway['gateway'] = $_POST['gateway'];
$gateway['descr'] = $_POST['descr'];
- $gateway['type'] = $_POST['type'];
if ($_POST['defaultgw'] == "yes") {
- $i=0;
- foreach ($a_gateways as $gateway) {
- if($id != $i && $config['gateways']['gateway_item'][$i]['type'] == $_POST['type']) {
- unset($config['gateways']['gateway_item'][$i]['defaultgw']);
- } else if ($config['gateways']['gateway_item'][$i]['type'] == $_POST['type']) {
- $config['gateways']['gateway_item'][$i]['defaultgw'] = true;
- }
+ $i = 0;
+ foreach($a_gateways as $gw) {
+ unset($config['gateways'][$i]['defaultgw']);
$i++;
}
+ $gateway['defaultgw'] = true;
+ } else {
+ unset($gateway['defaultgw']);
}
/* when saving the manual gateway we use the attribute which has the corresponding id */
@@ -232,32 +211,10 @@ include("head.inc");
<br> <span class="vexpl">Gateway name</span></td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncellreq">Type</td>
- <td width="78%" class="vtable">
- <select name="type" class="formselect">
- <?php
- if ($pconfig['type'] == 'IPv6') {
- $str = <<<EOD
- <option value="IPv4">IPv4</option>
- <option value="IPv6" selected>IPv6</option>
-EOD;
- } else {
- $str = <<<EOD
- <option value="IPv4" selected>IPv4</option>
- <option value="IPv6">IPv6</option>
-EOD;
- }
-
- echo $str;
- ?>
- </select>
- </td>
- </tr>
- <tr>
<td width="22%" valign="top" class="vncellreq">Gateway</td>
<td width="78%" class="vtable">
<input name="gateway" type="text" class="formfld host" id="gateway" size="40" value="<?=htmlspecialchars($pconfig['gateway']);?>">
- <br> <span class="vexpl">Gateway IPv4/IPv6 address</span></td>
+ <br> <span class="vexpl">Gateway IP address</span></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell">Default Gateway</td>
@@ -272,7 +229,7 @@ EOD;
<td width="78%" class="vtable">
<input name="monitor" type="text" id="monitor" value="<?php echo ($pconfig['monitor']) ; ?>" />
<strong>Alternative monitor IP</strong> <br />
- Enter an alternative address here to be used to monitor the link. This is used for the
+ Enter a alternative address here to be used to monitor the link. This is used for the
quality RRD graphs as well as the load balancer entries. Use this if the gateway does not respond
to icmp requests.</strong>
<br />
OpenPOWER on IntegriCloud