From d90212f3226c61f7c5916f51f88038d7542dc4e2 Mon Sep 17 00:00:00 2001 From: Bill Marquette Date: Sat, 6 Aug 2005 20:24:28 +0000 Subject: Fix editing Ensure unique pool names (we'll use this in virtual servers) Allow for monitor selection (TCP only for now) --- usr/local/www/load_balancer_pool.php | 2 +- usr/local/www/load_balancer_pool_edit.php | 65 ++++++++++++------------------- 2 files changed, 25 insertions(+), 42 deletions(-) (limited to 'usr') diff --git a/usr/local/www/load_balancer_pool.php b/usr/local/www/load_balancer_pool.php index d99e638..8085250 100755 --- a/usr/local/www/load_balancer_pool.php +++ b/usr/local/www/load_balancer_pool.php @@ -126,7 +126,7 @@ include("head.inc"); - + diff --git a/usr/local/www/load_balancer_pool_edit.php b/usr/local/www/load_balancer_pool_edit.php index 89b5437..9fadbc3 100755 --- a/usr/local/www/load_balancer_pool_edit.php +++ b/usr/local/www/load_balancer_pool_edit.php @@ -50,48 +50,19 @@ if (isset($id) && $a_pool[$id]) { } if ($_POST) { -echo "
";
-print_r($_POST);
-echo "
"; unset($input_errors); $pconfig = $_POST; /* input validation */ -// $reqdfields = explode(" ", "name"); -// $reqdfieldsn = explode(",", "Name"); + $reqdfields = explode(" ", "name"); + $reqdfieldsn = explode(",", "Name"); -// do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); - if (($_POST['subnet'] && !is_ipaddr($_POST['subnet']))) { - $input_errors[] = "A valid IP address must be specified."; - } - - if ($_POST['ipaddr'] == $config['interfaces']['wan']['ipaddr']) - $input_errors[] = "The WAN IP address may not be used in a virtual entry."; - - if ($_POST['ipaddr'] == $config['interfaces']['lan']['ipaddr']) - $input_errors[] = "The LAN IP address may not be used in a virtual entry."; - - /* check for overlaps with other virtual IP */ - foreach ($a_pool as $poolent) { - if (isset($id) && ($a_pool[$id]) && ($a_pool[$id] === $poolent)) - continue; - - if (isset($_POST['subnet']) && $_POST['subnet'] == $poolent['subnet']) { - $input_errors[] = "There is already a virtual IP entry for the specified IP address."; - break; - } - } - - /* check for overlaps with 1:1 NAT */ - if (is_array($config['nat']['onetoone'])) { - foreach ($config['nat']['onetoone'] as $natent) { - if (check_subnets_overlap($_POST['ipaddr'], 32, $natent['external'], $natent['subnet'])) { - $input_errors[] = "A 1:1 NAT mapping overlaps with the specified IP address."; - break; - } - } - } + /* Ensure that our pool names are unique */ + for ($i=0; isset($config['load_balancer']['pool'][$i]); $i++) + if (($_POST['name'] == $config['load_balancer']['pool'][$i]['name']) && ($i != $id)) + $input_errors[] = "This pool name has already been used. Pool names must be unique."; if (!$input_errors) { $poolent = array(); @@ -103,7 +74,7 @@ echo ""; $poolent['monitor'] = $_POST['monitor']; if (isset($id) && $a_pool[$id]) { - /* modify all virtual IP rules with this name */ + /* modify all virtual servers with this name */ for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) { if ($config['load_balancer']['virtual_server'][$i]['pool'] == $a_pool[$id]['name']) $config['load_balancer']['virtual_server'][$i]['pool'] = $poolent['name']; @@ -112,9 +83,6 @@ echo ""; } else $a_pool[] = $poolent; -echo "
";
-print_r($poolent);
-echo "
"; touch($d_poolconfdirty_path); write_config(); @@ -154,6 +122,14 @@ include("head.inc"); + + + + + +
+ Monitor: +
IP @@ -171,8 +147,15 @@ include("head.inc");
+ + + + +
- -- cgit v1.1