mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 00:54:41 +00:00
mvc/static routes, remove deleted static routes after apply. https://github.com/opnsense/core/issues/1774
This commit is contained in:
parent
591f7e8062
commit
33d98ca951
@ -34,6 +34,14 @@ require_once 'interfaces.inc';
|
||||
require_once 'filter.inc';
|
||||
require_once 'rrd.inc';
|
||||
|
||||
// drop deleted routes
|
||||
foreach (glob("/tmp/delete_route_*.todo") as $filename) {
|
||||
$network = trim(file_get_contents($filename));
|
||||
$inet = (is_subnetv6($network) ? "-inet6" : "-inet");
|
||||
mwexec("/sbin/route delete {$inet} " . escapeshellarg($network), true);
|
||||
unlink($filename);
|
||||
}
|
||||
|
||||
system_routing_configure('', true);
|
||||
filter_configure_sync(true);
|
||||
setup_gateways_monitor(true);
|
||||
|
||||
@ -122,6 +122,8 @@ class RoutesController extends ApiControllerBase
|
||||
if ($mdlRoute->route->del($uuid)) {
|
||||
// if item is removed, serialize to config and save
|
||||
$mdlRoute->serializeToConfig();
|
||||
// we don't know for sure if this route was already removed, flush to disk to remove on apply
|
||||
file_put_contents("/tmp/delete_route_{$uuid}.todo", (string)$node->network);
|
||||
Config::getInstance()->save();
|
||||
$result['result'] = 'deleted';
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user