mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-18 18:44:44 +00:00
system: add option to skip monitor host route #6002
This commit is contained in:
parent
a61afc7f46
commit
422b68f6c2
@ -101,7 +101,9 @@ function dpinger_host_routes()
|
||||
$routes = [];
|
||||
|
||||
foreach (dpinger_instances() as $gateway) {
|
||||
$routes[$gateway['monitor']] = $gateway['gateway'];
|
||||
if (!isset($gateway['monitor_noroute'])) {
|
||||
$routes[$gateway['monitor']] = $gateway['gateway'];
|
||||
}
|
||||
}
|
||||
|
||||
return $routes;
|
||||
@ -134,12 +136,15 @@ function dpinger_instances($ifconfig_details = null)
|
||||
$gateway['gateway'] .= '%' . get_real_interface($gateway['interface'], 'inet6');
|
||||
}
|
||||
|
||||
if (isset($routes[$gateway['monitor']])) {
|
||||
log_warning("Duplicated monitor route ignored for {$gateway['monitor']} on {$gateway['interface']}", LOG_WARNING);
|
||||
continue;
|
||||
if (!isset($gateway['monitor_noroute'])) {
|
||||
if (isset($routes[$gateway['monitor']])) {
|
||||
log_warning("Duplicated monitor route ignored for {$gateway['monitor']} on {$gateway['interface']}", LOG_WARNING);
|
||||
continue;
|
||||
}
|
||||
|
||||
$routes[$gateway['monitor']] = $gateway['gateway'];
|
||||
}
|
||||
|
||||
$routes[$gateway['monitor']] = $gateway['gateway'];
|
||||
$instances[$name] = $gateway;
|
||||
}
|
||||
|
||||
@ -238,8 +243,7 @@ function dpinger_configure_do($verbose = false, $gwname = null, $bootup = false)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* XXX add an option to skip an individual host route */
|
||||
if (true) {
|
||||
if (!isset($gateway['monitor_noroute'])) {
|
||||
system_host_route($gateway['monitor'], $gateway['gateway']);
|
||||
}
|
||||
|
||||
|
||||
@ -305,6 +305,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if ($pconfig['monitor_disable'] == "yes") {
|
||||
$gateway['monitor_disable'] = true;
|
||||
}
|
||||
if ($pconfig['monitor_noroute'] == "yes") {
|
||||
$gateway['monitor_noroute'] = true;
|
||||
}
|
||||
if ($pconfig['force_down'] == "yes") {
|
||||
$gateway['force_down'] = true;
|
||||
}
|
||||
@ -401,6 +404,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
'losslow',
|
||||
'monitor',
|
||||
'monitor_disable',
|
||||
'monitor_noroute',
|
||||
'name',
|
||||
'weight',
|
||||
'alert_interval',
|
||||
@ -567,6 +571,15 @@ $( document ).ready(function() {
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a id="help_for_monitor_noroute" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Disable Host Route "); ?></td>
|
||||
<td>
|
||||
<input name="monitor_noroute" type="checkbox" value="yes" <?=!empty($pconfig['monitor_noroute']) ? "checked=\"checked\"" : "";?>/>
|
||||
<div class="hidden" data-for="help_for_monitor_noroute">
|
||||
<?= gettext('Do not create a dedicated host route for this monitor.') ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a id="help_for_monitor" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Monitor IP"); ?></td>
|
||||
<td>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user