diff options
author | Renato Botelho <renato@netgate.com> | 2015-07-18 14:36:05 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-07-18 14:36:05 -0300 |
commit | 117948fdaa89fe78327eea9d914fe8474743f9fb (patch) | |
tree | fa1748dce8ccb301693302ac55c7e85ec21b4057 /usr/local/www/system_gateways_edit.php | |
parent | 2353f74c7af235637cda1a774455ffb5665d61d2 (diff) | |
parent | 205178aa8277442587aae5db76ff5510ebdcc5c9 (diff) | |
download | pfsense-117948fdaa89fe78327eea9d914fe8474743f9fb.zip pfsense-117948fdaa89fe78327eea9d914fe8474743f9fb.tar.gz |
Merge pull request #1738 from phil-davis/Static-Routes
Diffstat (limited to 'usr/local/www/system_gateways_edit.php')
-rw-r--r-- | usr/local/www/system_gateways_edit.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 8183214..af5e7cb 100644 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -130,6 +130,31 @@ if ($_POST) { } if (!is_validaliasname($_POST['name'])) { $input_errors[] = gettext("The gateway name must not contain invalid characters."); + } else if (isset($_POST['disabled'])) { + // We have a valid gateway name that the user wants to mark as disabled. + // Check if the gateway name is used in any gateway group. + if (is_array($config['gateways']['gateway_group'])) { + foreach ($config['gateways']['gateway_group'] as $group) { + foreach ($group['item'] as $item) { + $items = explode("|", $item); + if ($items[0] == $_POST['name']) { + $input_errors[] = sprintf(gettext("Gateway '%s' cannot be disabled because it is in use on Gateway Group '%s'"), $_POST['name'], $group['name']); + } + } + } + } + + // Check if the gateway name is used in any enabled Static Route. + if (is_array($config['staticroutes']['route'])) { + foreach ($config['staticroutes']['route'] as $route) { + if ($route['gateway'] == $_POST['name']) { + if (!isset($route['disabled'])) { + // There is a static route that uses this gateway and is enabled (not disabled). + $input_errors[] = sprintf(gettext("Gateway '%s' cannot be disabled because it is in use on Static Route '%s'"), $_POST['name'], $route['network']); + } + } + } + } } /* skip system gateways which have been automatically added */ if (($_POST['gateway'] && (!is_ipaddr($_POST['gateway'])) && ($_POST['attribute'] !== "system")) && ($_POST['gateway'] != "dynamic")) { |