Revision cbd61636
Added by Jim Pingle almost 9 years ago
src/usr/local/www/system_gateways.php | ||
---|---|---|
151 | 151 |
return; |
152 | 152 |
} |
153 | 153 |
|
154 |
/* If the removed gateway was the default route, remove the default route */ |
|
155 |
if (!empty($a_gateways[$id]) && is_ipaddr($a_gateways[$id]['gateway']) && |
|
156 |
!isset($a_gateways[$id]['disabled']) && |
|
157 |
isset($a_gateways[$id]['defaultgw'])) { |
|
158 |
$inet = (!is_ipaddrv4($a_gateways[$id]['gateway']) ? '-inet6' : '-inet'); |
|
159 |
mwexec("/sbin/route delete {$inet} default"); |
|
160 |
} |
|
161 |
|
|
154 | 162 |
/* NOTE: Cleanup static routes for the interface route if any */ |
155 | 163 |
if (!empty($a_gateways[$id]) && is_ipaddr($a_gateways[$id]['gateway']) && |
156 | 164 |
$gateway['gateway'] != $a_gateways[$id]['gateway'] && |
... | ... | |
227 | 235 |
if ($ok_to_toggle) { |
228 | 236 |
if ($disable_gw) { |
229 | 237 |
$a_gateway_item[$realid]['disabled'] = true; |
238 |
/* If the disabled gateway was the default route, remove the default route */ |
|
239 |
if (!empty($a_gateway_item[$realid]) && is_ipaddr($a_gateway_item[$realid]['gateway']) && |
|
240 |
isset($a_gateway_item[$realid]['defaultgw'])) { |
|
241 |
$inet = (!is_ipaddrv4($a_gateway_item[$realid]['gateway']) ? '-inet6' : '-inet'); |
|
242 |
mwexec("/sbin/route delete {$inet} default"); |
|
243 |
} |
|
230 | 244 |
} else { |
231 | 245 |
unset($a_gateway_item[$realid]['disabled']); |
232 | 246 |
} |
src/usr/local/www/system_gateways_edit.php | ||
---|---|---|
526 | 526 |
|
527 | 527 |
if (isset($_POST['disabled'])) { |
528 | 528 |
$gateway['disabled'] = true; |
529 |
/* Check if the gateway was enabled but changed to disabled. */ |
|
530 |
if ((isset($realid) && $a_gateway_item[$realid]) && ($pconfig['disabled'] == false)) { |
|
531 |
/* If the disabled gateway was the default route, remove the default route */ |
|
532 |
if (is_ipaddr($gateway['gateway']) && |
|
533 |
isset($gateway['defaultgw'])) { |
|
534 |
$inet = (!is_ipaddrv4($gateway['gateway']) ? '-inet6' : '-inet'); |
|
535 |
mwexec("/sbin/route delete {$inet} default"); |
|
536 |
} |
|
537 |
} |
|
529 | 538 |
} else { |
530 | 539 |
unset($gateway['disabled']); |
531 | 540 |
} |
Also available in: Unified diff
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)