diff options
author | jim-p <jimp@pfsense.org> | 2016-11-04 14:06:01 -0400 |
---|---|---|
committer | Steve Beaver <sbeaver@netgate.com> | 2016-11-04 14:39:40 -0400 |
commit | cbd61636a1dd4db3fa0da8829a44d07059b9b427 (patch) | |
tree | 9d60fa6aa225cb0a8a446eaf45fbb05ac09903f3 /src/usr/local/www/system_gateways_edit.php | |
parent | 96ff627ff95e0fcadf8c15dbd6fe681309cb0fd8 (diff) | |
download | pfsense-cbd61636a1dd4db3fa0da8829a44d07059b9b427.zip pfsense-cbd61636a1dd4db3fa0da8829a44d07059b9b427.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
(cherry picked from commit 1be1b87b5f9ab8d0a259b888aab08ec6babad568)
Diffstat (limited to 'src/usr/local/www/system_gateways_edit.php')
-rw-r--r-- | src/usr/local/www/system_gateways_edit.php | 9 |
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 b4ed994..784e9a8 100644 --- a/src/usr/local/www/system_gateways_edit.php +++ b/src/usr/local/www/system_gateways_edit.php @@ -526,6 +526,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']); } |