mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 00:07:26 +00:00
System: Gateways: Configuration - move affected gateways into monitor event (introduced monitor_killstates in ff91932d5d) and kill states in 20-recover when configured. for https://github.com/opnsense/core/issues/6803
This commit is contained in:
parent
0538ef324e
commit
b61f21ae6b
@ -50,7 +50,11 @@ foreach (glob("/tmp/delete_route_*.todo") as $filename) {
|
||||
system_routing_configure(true, null, !$monitor_hook);
|
||||
|
||||
if ($monitor_hook) {
|
||||
passthru('/usr/local/etc/rc.syshook monitor');
|
||||
$cmd = ['/usr/local/etc/rc.syshook monitor'];
|
||||
for ($i = 2; $i < count($argv); $i++) {
|
||||
$cmd[] = escapeshellcmd($argv[$i]);
|
||||
}
|
||||
passthru(implode(' ', $cmd));
|
||||
}
|
||||
|
||||
filter_configure_sync(true, false);
|
||||
|
||||
@ -33,11 +33,15 @@ require_once 'system.inc';
|
||||
require_once 'interfaces.inc';
|
||||
|
||||
$gwnames = [];
|
||||
$affected_gateways = !empty($argv[1]) ? explode(',', $argv[1]) : [];
|
||||
|
||||
foreach (return_gateways_status() as $status) {
|
||||
if ($status['status'] == 'down') {
|
||||
/* try to recover monitors stuck in down state ignoring "force_down" */
|
||||
$gwnames[] = $status['name'];
|
||||
if (!empty($status['monitor_killstates']) && in_array($status['name'], $affected_gateways)) {
|
||||
configdp_run('filter kill gateway_states', [$status['gateway']], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -76,6 +76,7 @@ while (1) {
|
||||
}
|
||||
|
||||
/* run main watcher pass */
|
||||
$alarm_gateways = [];
|
||||
foreach ($status as $report) {
|
||||
$ralarm = false;
|
||||
|
||||
@ -131,10 +132,7 @@ while (1) {
|
||||
$report['stddev'],
|
||||
$report['loss']
|
||||
));
|
||||
|
||||
if ($report['status'] == 'down' && !empty($report['monitor_killstates'])) {
|
||||
configdp_run('filter kill gateway_states', [$report['gateway']], true);
|
||||
}
|
||||
$alarm_gateways[] = $report['name'];
|
||||
|
||||
/* update cached state now */
|
||||
$mode[$report['name']] = $report['status'];
|
||||
@ -142,7 +140,7 @@ while (1) {
|
||||
}
|
||||
|
||||
if ($alarm && $action != null) {
|
||||
configd_run($action);
|
||||
configdp_run($action, [implode(',', $alarm_gateways)]);
|
||||
}
|
||||
|
||||
sleep($alarm ? $wait : $poll);
|
||||
|
||||
@ -135,9 +135,9 @@ message:reconfiguring routing
|
||||
|
||||
[routes.alarm]
|
||||
command:/usr/local/bin/flock -n -E 0 -o /tmp/filter_reload_gateway.lock /usr/local/etc/rc.routing_configure alarm
|
||||
parameters:
|
||||
parameters: %s
|
||||
type:script
|
||||
message:reconfiguring routing due to gateway alarm
|
||||
message:reconfiguring routing due to gateway alarm (%s)
|
||||
description:Manual gateway switch
|
||||
|
||||
[route.del]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user