Revision e75f0e7d
Added by Pi Ba over 9 years ago
src/usr/local/www/system_gateways.php | ||
---|---|---|
155 | 155 |
return; |
156 | 156 |
} |
157 | 157 |
|
158 |
/* NOTE: Cleanup static routes for the interface route if any */ |
|
159 |
if (!empty($a_gateways[$id]) && is_ipaddr($a_gateways[$id]['gateway']) && |
|
160 |
$gateway['gateway'] != $a_gateways[$id]['gateway'] && |
|
161 |
isset($a_gateways[$id]["nonlocalgateway"])) { |
|
162 |
$realif = get_real_interface($a_gateways[$id]['interface']); |
|
163 |
$inet = (!is_ipaddrv4($a_gateways[$id]['gateway']) ? "-inet6" : "-inet"); |
|
164 |
$cmd = "/sbin/route delete $inet " . escapeshellarg($a_gateways[$id]['gateway']) . " -iface " . escapeshellarg($realif); |
|
165 |
mwexec($cmd); |
|
166 |
} |
|
158 | 167 |
/* NOTE: Cleanup static routes for the monitor ip if any */ |
159 | 168 |
if (!empty($a_gateways[$id]['monitor']) && |
160 | 169 |
$a_gateways[$id]['monitor'] != "dynamic" && |
src/usr/local/www/system_gateways_edit.php | ||
---|---|---|
526 | 526 |
$gateway['monitor'] = $_POST['monitor']; |
527 | 527 |
} |
528 | 528 |
|
529 |
/* NOTE: If gateway ip is changed need to cleanup the old static interface route */ |
|
530 |
if ($_POST['monitor'] != "dynamic" && !empty($a_gateway_item[$realid]) && is_ipaddr($a_gateway_item[$realid]['gateway']) && |
|
531 |
$gateway['gateway'] != $a_gateway_item[$realid]['gateway'] && |
|
532 |
isset($a_gateway_item[$realid]["nonlocalgateway"])) { |
|
533 |
$realif = get_real_interface($a_gateway_item[$realid]['interface']); |
|
534 |
$inet = (!is_ipaddrv4($a_gateway_item[$realid]['gateway']) ? "-inet6" : "-inet"); |
|
535 |
$cmd = "/sbin/route delete $inet " . escapeshellarg($a_gateway_item[$realid]['gateway']) . " -iface " . escapeshellarg($realif); |
|
536 |
mwexec($cmd); |
|
537 |
} |
|
538 |
|
|
529 | 539 |
/* NOTE: If monitor ip is changed need to cleanup the old static route */ |
530 | 540 |
if ($_POST['monitor'] != "dynamic" && !empty($a_gateway_item[$realid]) && is_ipaddr($a_gateway_item[$realid]['monitor']) && |
531 | 541 |
$_POST['monitor'] != $a_gateway_item[$realid]['monitor'] && $gateway['gateway'] != $a_gateway_item[$realid]['monitor']) { |
Also available in: Unified diff
cleanup static routes for interface nonlocal gateways when being deleted or changed.