mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 19:15:22 +00:00
system: run monitor reload inside system_routing_configure() #5956
Some call flows require this, others don't and on 22.7 we seem to miss one that did. Instead of adding more monitor reloads in the possible spots move the ones that are shared into the general routing reload since the two are almost always clustered together. Also use the $interface argument to figure out which monitors require reloading. This will avoid quite a few spurious reloads on larger setups. Boot is a little special, but easy enough to ensure we don't call monitor reload twice.
This commit is contained in:
parent
9f8906647e
commit
20a60050ee
@ -99,7 +99,7 @@ function dpinger_syslog()
|
||||
function dpinger_configure_do($verbose = false, $gwname = null, $bootup = false)
|
||||
{
|
||||
if ($verbose) {
|
||||
echo 'Setting up gateway monitors...';
|
||||
echo sprintf('Setting up gateway monitor%s...', empty($gwname) ? 's': " {$gwname}");
|
||||
flush();
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ function dpinger_configure_do($verbose = false, $gwname = null, $bootup = false)
|
||||
|
||||
$ifconfig_details = legacy_interfaces_details();
|
||||
$gateways = new \OPNsense\Routing\Gateways($ifconfig_details);
|
||||
$monitor_ips = array();
|
||||
$monitor_ips = [];
|
||||
|
||||
$dpinger_default = dpinger_defaults();
|
||||
foreach ($gateways->gatewaysIndexedByName(true) as $name => $gateway) {
|
||||
|
||||
@ -590,7 +590,7 @@ function system_default_route($gateway, $family, $interface, $far = false)
|
||||
mwexecf('/sbin/route add -%s default %s', array($family, $gateway));
|
||||
}
|
||||
|
||||
function system_routing_configure($verbose = false, $interface = '')
|
||||
function system_routing_configure($verbose = false, $interface = null, $monitor = true)
|
||||
{
|
||||
if ($verbose) {
|
||||
echo 'Setting up routes...';
|
||||
@ -625,9 +625,25 @@ function system_routing_configure($verbose = false, $interface = '')
|
||||
if ($verbose) {
|
||||
echo "done.\n";
|
||||
}
|
||||
|
||||
if ($monitor) {
|
||||
$reloads = [];
|
||||
|
||||
if (!empty($interface)) {
|
||||
foreach ($gateways->gatewaysIndexedByName(true) as $name => $gateway) {
|
||||
if ($interface == $gateway['interface']) {
|
||||
$reloads[] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (count($reloads) ? $reloads : [null] as $reload) {
|
||||
plugins_configure('monitor', $verbose, [$reload]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function system_staticroutes_configure($interface = '')
|
||||
function system_staticroutes_configure($interface = null)
|
||||
{
|
||||
$static_routes = get_staticroutes(false);
|
||||
if (count($static_routes)) {
|
||||
|
||||
@ -91,7 +91,7 @@ interfaces_configure(true);
|
||||
system_resolvconf_generate(true);
|
||||
filter_configure_sync(true);
|
||||
plugins_configure('early', true);
|
||||
system_routing_configure(true);
|
||||
system_routing_configure(true, null, false);
|
||||
|
||||
system_hosts_generate(true);
|
||||
plugins_configure('dhcp', true);
|
||||
|
||||
@ -165,7 +165,6 @@ $intf_ipaddr = $config['interfaces'][$interface]['ipaddr'];
|
||||
|
||||
if ($ip != $cacheip || (!is_ipaddr($intf_ipaddr) && $intf_ipaddr != 'dhcp')) {
|
||||
system_routing_configure(false, $interface);
|
||||
plugins_configure('monitor');
|
||||
filter_configure_sync();
|
||||
|
||||
if (isset($config['system']['ip_change_kill_states'])) {
|
||||
|
||||
@ -99,7 +99,6 @@ if ($config['interfaces'][$interface]['ipaddrv6'] == 'slaac') {
|
||||
link_interface_to_track6($interface, true);
|
||||
|
||||
system_routing_configure(false, $interface);
|
||||
plugins_configure('monitor');
|
||||
filter_configure_sync();
|
||||
|
||||
/* register IP change not before this point as basic connectivity is needed */
|
||||
|
||||
@ -42,5 +42,4 @@ foreach (glob("/tmp/delete_route_*.todo") as $filename) {
|
||||
}
|
||||
|
||||
system_routing_configure(true);
|
||||
plugins_configure('monitor', true);
|
||||
filter_configure_sync(true);
|
||||
|
||||
@ -573,7 +573,6 @@ system_hosts_generate(true);
|
||||
system_resolvconf_generate(true);
|
||||
interface_bring_down($interface);
|
||||
interface_configure(true, $interface, true);
|
||||
plugins_configure('monitor', true);
|
||||
filter_configure_sync(true);
|
||||
|
||||
if ($restart_dhcpd) {
|
||||
|
||||
@ -582,10 +582,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
}
|
||||
|
||||
system_routing_configure();
|
||||
plugins_configure('monitor');
|
||||
filter_configure();
|
||||
foreach ($toapplylist as $ifapply => $ifcfgo) {
|
||||
plugins_configure('newwanip', false, array($ifapply));
|
||||
plugins_configure('newwanip', false, [$ifapply]);
|
||||
}
|
||||
rrd_configure();
|
||||
}
|
||||
|
||||
@ -129,7 +129,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
// apply changes, reconfigure
|
||||
system_routing_configure();
|
||||
clear_subsystem_dirty('staticroutes');
|
||||
plugins_configure('monitor');
|
||||
filter_configure();
|
||||
header(url_safe('Location: /system_gateways.php?displaysave=true'));
|
||||
exit;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user