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_routes.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_routes.php')
-rw-r--r-- | usr/local/www/system_routes.php | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/usr/local/www/system_routes.php b/usr/local/www/system_routes.php index 4d44557..9443d40 100644 --- a/usr/local/www/system_routes.php +++ b/usr/local/www/system_routes.php @@ -53,6 +53,7 @@ if (!is_array($config['staticroutes']['route'])) { $a_routes = &$config['staticroutes']['route']; $a_gateways = return_gateways_array(true, true, true); $changedesc_prefix = gettext("Static Routes") . ": "; +unset($input_errors); if ($_POST) { @@ -142,20 +143,29 @@ if (isset($_POST['del_x'])) { } else if ($_GET['act'] == "toggle") { if ($a_routes[$_GET['id']]) { + $do_update_config = true; if (isset($a_routes[$_GET['id']]['disabled'])) { - unset($a_routes[$_GET['id']]['disabled']); - $changedesc = $changedesc_prefix . gettext("enabled route to") . " " . $a_routes[$_GET['id']]['network']; + // Do not enable a route whose gateway is disabled + if (isset($a_gateways[$a_routes[$_GET['id']]['gateway']]['disabled'])) { + $do_update_config = false; + $input_errors[] = $changedesc_prefix . gettext("gateway is disabled, cannot enable route to") . " " . $a_routes[$_GET['id']]['network']; + } else { + unset($a_routes[$_GET['id']]['disabled']); + $changedesc = $changedesc_prefix . gettext("enabled route to") . " " . $a_routes[$_GET['id']]['network']; + } } else { delete_static_route($_GET['id']); $a_routes[$_GET['id']]['disabled'] = true; $changedesc = $changedesc_prefix . gettext("disabled route to") . " " . $a_routes[$_GET['id']]['network']; } - if (write_config($changedesc)) { - mark_subsystem_dirty('staticroutes'); + if ($do_update_config) { + if (write_config($changedesc)) { + mark_subsystem_dirty('staticroutes'); + } + header("Location: system_routes.php"); + exit; } - header("Location: system_routes.php"); - exit; } } else { /* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to find move button clicks instead... */ @@ -225,6 +235,7 @@ include("head.inc"); <?php if (is_subsystem_dirty('staticroutes')): ?><p> <?php print_info_box_np(sprintf(gettext("The static route configuration has been changed.%sYou must apply the changes in order for them to take effect."), "<br />"));?><br /></p> <?php endif; ?> +<?php if ($input_errors) print_input_errors($input_errors); ?> <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="system routes"> <tr> |