diff options
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/system_gateways.php | 9 | ||||
-rwxr-xr-x | usr/local/www/system_gateways_edit.php | 11 |
2 files changed, 19 insertions, 1 deletions
diff --git a/usr/local/www/system_gateways.php b/usr/local/www/system_gateways.php index 016ed45..5fdec7f 100755 --- a/usr/local/www/system_gateways.php +++ b/usr/local/www/system_gateways.php @@ -104,6 +104,15 @@ if ($_GET['act'] == "del") { } } if ($remove == true) { + /* NOTE: Cleanup static routes for the monitor ip if any */ + if (!empty($a_gateways[$_GET['id']]['monitor']) && $a_gateways[$_GET['id']]['monitor'] != "dynamic" && is_ipaddr($a_gateways[$_GET['id']]['monitor']) && + $a_gateways[$_GET['id']]['monitor'] != $a_gateways[$_GET['id']]['monitor'] && $a_gateways[$_GET['id']]['gateway'] != $a_gateways[$_GET['id']]['monitor']) { + if (is_ipaddrv4($a_gateways[$_GET['id']]['monitor'])) + mwexec("/sbin/route delete " . escapeshellarg($a_gateways[$_GET['id']]['monitor'])); + else + mwexec("/sbin/route delete -inet6 " . escapeshellarg($a_gateways[$_GET['id']]['monitor'])); + } + if ($config['interfaces'][$a_gateways[$_GET['id']]['friendlyiface']]['gateway'] == $a_gateways[$_GET['id']]['name']) unset($config['interfaces'][$a_gateways[$_GET['id']]['friendlyiface']]['gateway']); $changedesc .= "removed gateway {$realid}"; diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 417184c..7abd1f4 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -384,8 +384,17 @@ if ($_POST) { $gateway['descr'] = $_POST['descr']; if ($_POST['monitor_disable'] == "yes") $gateway['monitor_disable'] = true; - else if (is_ipaddr($_POST['monitor'])) + else if (is_ipaddr($_POST['monitor'])) { + /* NOTE: If monitor ip is changed need to cleanup the old static route */ + if ($_POST['monitor'] != "dynamic" && !empty($a_gateway_item[$id]) && is_ipaddr($a_gateway_item[$id]['monitor']) && + $_POST['monitor'] != $a_gateway_item[$id]['monitor'] && $gateway['gateway'] != $a_gateway_item[$id]['monitor']) { + if (is_ipaddrv4($a_gateway_item[$id]['monitor'])) + mwexec("/sbin/route delete " . escapeshellarg($a_gateway_item[$id]['monitor'])); + else + mwexec("/sbin/route delete -inet6 " . escapeshellarg($a_gateway_item[$id]['monitor'])); + } $gateway['monitor'] = $_POST['monitor']; + } if ($_POST['defaultgw'] == "yes" || $_POST['defaultgw'] == "on") { $i = 0; |