diff --git a/src/etc/inc/plugins.inc.d/dpinger.inc b/src/etc/inc/plugins.inc.d/dpinger.inc index d1295a86c..a7e53e51a 100644 --- a/src/etc/inc/plugins.inc.d/dpinger.inc +++ b/src/etc/inc/plugins.inc.d/dpinger.inc @@ -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']); } diff --git a/src/www/system_gateways_edit.php b/src/www/system_gateways_edit.php index db44d5bc8..6870e4965 100644 --- a/src/www/system_gateways_edit.php +++ b/src/www/system_gateways_edit.php @@ -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() { +