From 2328dcc5f0fd5cd875ec15d47260d3626615bb0d Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 21 Dec 2009 15:27:20 +0100 Subject: Partial rewrite of gateway code, now partially facilitates dynamic interfaces - Upgrade code takes different naming into account - Add gateway entries for dynamic interfaces - Rewrite status array to also support dynamic interfaces. - Always use unique localhost monitor IP addresses for down dynamic interfaces - Accept the gateway IP address of "dynamic" on the gateway edit page --- usr/local/www/system_gateways_edit.php | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'usr') diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 170f071..20f303d 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -90,7 +90,7 @@ if ($_POST) { $input_errors[] = "The gateway name must not contain invalid characters."; } /* skip system gateways which have been automatically added */ - if ($_POST['gateway'] && (!is_ipaddr($_POST['gateway'])) && ($pconfig['attribute'] != "system")) { + if (($_POST['gateway'] && (!is_ipaddr($_POST['gateway'])) && ($pconfig['attribute'] != "system")) && (! $_POST['gateway'] == "dynamic")) { $input_errors[] = "A valid gateway IP address must be specified."; } if ($_POST['gateway'] && (is_ipaddr($_POST['gateway'])) && ($pconfig['attribute'] != "system")) { @@ -107,20 +107,26 @@ if ($_POST) { if (isset($_POST['name'])) { /* check for overlaps */ foreach ($a_gateways as $gateway) { - if (isset($id) && ($a_gateways[$id]) && ($a_gateways[$id] === $gateway)) + if (isset($id) && ($a_gateways[$id]) && ($a_gateways[$id] === $gateway)) { continue; - - if (($gateway['name'] <> "") && (in_array($_POST['name'], $gateway)) && ($gateway['attribute'] != "system")) { - $input_errors[] = "The gateway name \"{$_POST['name']}\" already exists."; - break; } - if (($gateway['gateway'] <> "") && (in_array($_POST['gateway'], $gateway)) && ($gateway['attribute'] != "system")) { - $input_errors[] = "The gateway IP address \"{$_POST['gateway']}\" already exists."; - break; + if($_POST['name'] <> "") { + if (($gateway['name'] <> "") && (in_array($_POST['name'], $gateway)) && ($gateway['attribute'] != "system")) { + $input_errors[] = "The gateway name \"{$_POST['name']}\" already exists."; + break; + } + } + if(is_ipaddr($_POST['gateway'])) { + if (($gateway['gateway'] <> "") && (in_array($_POST['gateway'], $gateway)) && ($gateway['attribute'] != "system")) { + $input_errors[] = "The gateway IP address \"{$_POST['gateway']}\" already exists."; + break; + } } - if (($gateway['monitorip'] <> "") && (in_array($_POST['monitor'], $gateway)) && ($gateway['attribute'] != "system")) { - $input_errors[] = "The monitor IP address \"{$_POST['monitor']}\" is already in use. You must choose a different monitor IP."; - break; + if(is_ipaddr($_POST['monitor'])) { + if (($gateway['monitor'] <> "") && (in_array($_POST['monitor'], $gateway)) && ($gateway['attribute'] != "system")) { + $input_errors[] = "The monitor IP address \"{$_POST['monitor']}\" is already in use. You must choose a different monitor IP."; + break; + } } } } @@ -180,6 +186,7 @@ if ($_POST) { } } + $pgtitle = array("System","Gateways","Edit gateway"); include("head.inc"); -- cgit v1.1