summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/system_gateways_edit.php
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2016-11-04 14:06:01 -0400
committerjim-p <jimp@pfsense.org>2016-11-04 14:06:53 -0400
commit1be1b87b5f9ab8d0a259b888aab08ec6babad568 (patch)
treeb8b7add53a02560faffbf7a4cdde05022eb70de6 /src/usr/local/www/system_gateways_edit.php
parentf92d44da5a4958372c7fb925043abc34588143e3 (diff)
downloadpfsense-1be1b87b5f9ab8d0a259b888aab08ec6babad568.zip
pfsense-1be1b87b5f9ab8d0a259b888aab08ec6babad568.tar.gz
When deleting or disabling a non-dynamic gateway, if that gateway was set as default then remove the corresponding default route to respect the user's decision. Fixes #6659
Diffstat (limited to 'src/usr/local/www/system_gateways_edit.php')
-rw-r--r--src/usr/local/www/system_gateways_edit.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/usr/local/www/system_gateways_edit.php b/src/usr/local/www/system_gateways_edit.php
index bf5211b..0903aea 100644
--- a/src/usr/local/www/system_gateways_edit.php
+++ b/src/usr/local/www/system_gateways_edit.php
@@ -494,6 +494,15 @@ if ($_POST) {
if (isset($_POST['disabled'])) {
$gateway['disabled'] = true;
+ /* Check if the gateway was enabled but changed to disabled. */
+ if ((isset($realid) && $a_gateway_item[$realid]) && ($pconfig['disabled'] == false)) {
+ /* If the disabled gateway was the default route, remove the default route */
+ if (is_ipaddr($gateway['gateway']) &&
+ isset($gateway['defaultgw'])) {
+ $inet = (!is_ipaddrv4($gateway['gateway']) ? '-inet6' : '-inet');
+ mwexec("/sbin/route delete {$inet} default");
+ }
+ }
} else {
unset($gateway['disabled']);
}
OpenPOWER on IntegriCloud