diff options
author | Ermal <eri@pfsense.org> | 2011-07-28 20:31:46 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2011-07-28 20:31:57 +0000 |
commit | 33c06ef791a58d95df4c6674a8e87e5b1186689c (patch) | |
tree | 16ded2b30af558c4e53a0f982dbd9baa63707cd9 | |
parent | 4c41b626539a103834a9e93f5be34afcfa6777a9 (diff) | |
download | pfsense-33c06ef791a58d95df4c6674a8e87e5b1186689c.zip pfsense-33c06ef791a58d95df4c6674a8e87e5b1186689c.tar.gz |
Add a new option to allow disabling of gateway monitoring. This gateways will always be reported as up.
-rw-r--r-- | etc/inc/gwlb.inc | 16 | ||||
-rwxr-xr-x | usr/local/www/system_gateways_edit.php | 18 |
2 files changed, 27 insertions, 7 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 382bfba..6b54c07 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -137,6 +137,9 @@ target default { EOD; foreach($gateways_arr as $name => $gateway) { + /* Do not monitor if such was requested */ + if (isset($gateway['monitor_disable'])) + continue; if (empty($gateway['monitor']) || !is_ipaddr($gateway['monitor'])) { if (is_ipaddr($gateway['gateway'])) $gateway['monitor'] = $gateway['gateway']; @@ -287,7 +290,9 @@ function return_gateways_array($disabled = false) { $gateway['gateway'] = "dynamic"; $gateway['dynamic'] = true; } - if(empty($gateway['monitor'])) + if (isset($gateway['monitor_disable'])) + $gateway['monitor_disable'] = true; + else if (empty($gateway['monitor'])) $gateway['monitor'] = $gateway['gateway']; $gateway['friendlyiface'] = $gateway['interface']; @@ -383,18 +388,18 @@ function return_gateway_groups_array() { if (isset($gwsttng['defaultgw'])) { $dfltgwfound = true; $dfltgwname = $gwname; - if (stristr($gateways_status[$gwname]['status'], "down")) + if (!isset($gwsttng['monitor_disable']) && stristr($gateways_status[$gwname]['status'], "down")) $dfltgwdown = true; } /* Keep a record of the last up gateway */ - if (empty($upgw) && !stristr($gateways_status[$gwname]['status'], "down")) + if (empty($upgw) && (isset($gwsttng['monitor_disable']) || !stristr($gateways_status[$gwname]['status'], "down"))) $upgw = $gwname; if ($dfltgwdown == true && !empty($upgw)) break; } if ($dfltgwfound == false) { $gwname = convert_friendly_interface_to_friendly_descr("wan"); - if (stristr($gateways_status[$gwname]['status'], "down")) + if (!empty($gateways_status[$gwname]) && stristr($gateways_status[$gwname]['status'], "down")) $dfltgwdown = true; } if ($dfltgwdown == true && !empty($upgw)) { @@ -449,7 +454,8 @@ function return_gateway_groups_array() { } else /* Online add member */ $tiers[$tier][] = $gwname; - } + } else if (isset($gateways_arr[$gwname]['monitor_disable'])) + $tiers[$tier][] = $gwname; } $tiers_count = count($tiers); if($tiers_count == 0) { diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index f34df9f..0d35424 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -78,6 +78,7 @@ if (isset($id) && $a_gateways[$id]) { $pconfig['losshigh'] = $a_gateway_item[$id]['losshigh']; $pconfig['down'] = $a_gateway_item[$id]['down']; $pconfig['monitor'] = $a_gateways[$id]['monitor']; + $pconfig['monitor_disable'] = isset($a_gateways[$id]['monitor_disable']); $pconfig['descr'] = $a_gateways[$id]['descr']; $pconfig['attribute'] = $a_gateways[$id]['attribute']; } @@ -233,7 +234,9 @@ if ($_POST) { $gateway['name'] = $_POST['name']; $gateway['weight'] = $_POST['weight']; $gateway['descr'] = $_POST['descr']; - if (is_ipaddr($_POST['monitor'])) + if ($_POST['monitor_disable'] == "yes") + $gateway['monitor_disable'] = true; + else if (is_ipaddr($_POST['monitor'])) $gateway['monitor'] = $_POST['monitor']; if ($_POST['defaultgw'] == "yes" || $_POST['defaultgw'] == "on") { @@ -307,6 +310,9 @@ function show_advanced_gateway() { aodiv = document.getElementById('showgatewayadv'); aodiv.style.display = "block"; } +function monitor_change() { + document.iform.monitor.disabled = document.iform.monitor_disable.checked; +} </script> <?php if ($input_errors) print_input_errors($input_errors); ?> <form action="system_gateways_edit.php" method="post" name="iform" id="iform"> @@ -366,6 +372,14 @@ function show_advanced_gateway() { </td> </tr> <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Disable Gateway Monitoring"); ?></td> + <td width="78%" class="vtable"> + <input name="monitor_disable" type="checkbox" id="monitor_disable" value="yes" <?php if ($pconfig['monitor_disable'] == true) echo "checked"; ?> onClick="monitor_change()" /> + <strong><?=gettext("Disable Gateway Monitoring"); ?></strong><br /> + <?=gettext("This will consider this gateway as always being up"); ?> + </td> + </tr> + <tr> <td width="22%" valign="top" class="vncell"><?=gettext("Monitor IP"); ?></td> <td width="78%" class="vtable"> <?php @@ -461,7 +475,7 @@ function show_advanced_gateway() { </form> <?php include("fend.inc"); ?> <script language="JavaScript"> -enable_change(document.iform.defaultgw); +monitor_change(); </script> </body> </html> |