system: manual gateway switch via cron for #7027

This commit is contained in:
Franco Fichtner 2024-08-28 10:13:34 +02:00
parent 0b42c910c4
commit c0bee56c10
2 changed files with 5 additions and 2 deletions

View File

@ -35,9 +35,10 @@ require_once 'filter.inc';
exit_on_bootup();
/* when called with an argument we are in gateway switch mode */
$recover_only = !empty($argv[1]);
// drop deleted routes
/* drop deleted routes */
foreach (glob("/tmp/delete_route_*.todo") as $filename) {
$network = trim(file_get_contents($filename));
$inet = (is_subnetv6($network) ? "-inet6" : "-inet");
@ -46,7 +47,6 @@ foreach (glob("/tmp/delete_route_*.todo") as $filename) {
}
system_routing_configure(true, null, !$recover_only);
filter_configure_sync(true, false);
if ($recover_only) {
foreach (dpinger_status() as $status) {
@ -56,3 +56,5 @@ if ($recover_only) {
}
}
}
filter_configure_sync(true, false);

View File

@ -138,6 +138,7 @@ command:/usr/local/bin/flock -n -E 0 -o /tmp/filter_reload_gateway.lock /usr/loc
parameters:
type:script
message:reconfiguring routing due to gateway alarm
description:Manual gateway switch
[route.del]
command: /usr/local/opnsense/scripts/routes/del_route.py