summaryrefslogtreecommitdiffstats
path: root/etc/inc/gwlb.inc
diff options
context:
space:
mode:
authorsmos <seth.mos@dds.nl>2012-06-25 18:44:46 +0200
committersmos <seth.mos@dds.nl>2012-06-25 18:44:46 +0200
commit47c48e285b2a6d0e0eaf5c453d90a702eaea5dd4 (patch)
tree1882fc567132453dffac6785109a4d1960cdf797 /etc/inc/gwlb.inc
parenta2beee7597b1ed52961e218deba18caa278337ab (diff)
downloadpfsense-47c48e285b2a6d0e0eaf5c453d90a702eaea5dd4.zip
pfsense-47c48e285b2a6d0e0eaf5c453d90a702eaea5dd4.tar.gz
Check in code that allows for using a gateway group as the interface on the OpenVPN server page. Only allow IPv4 gateway groups for now. We'll need to add IPv6 suppport here later when we import OpenVPN 2.3.
Unbreak the gateway group function on broken configurations like a missing 3G stick. Unbreak the interface IP/IPv6 code in openvpn.inc, we can listen on IPv4 or IPv6, not both. That path is now seperate which should cause less grief down the line. Adds to Redmine ticket #1965 which was for the IPsec failover.
Diffstat (limited to 'etc/inc/gwlb.inc')
-rw-r--r--etc/inc/gwlb.inc34
1 files changed, 24 insertions, 10 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index cf982af..29b0064 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -282,6 +282,7 @@ function return_gateways_status($byname = false) {
$target = $info[0];
else
$target = $info[2];
+
$status[$target]['monitorip'] = $info[0];
$status[$target]['srcip'] = $info[1];
$status[$target]['name'] = $info[2];
@@ -291,7 +292,8 @@ function return_gateways_status($byname = false) {
$status[$target]['status'] = trim($info[8]);
}
- /* tack on any gateways that have monitoring disabled */
+ /* tack on any gateways that have monitoring disabled
+ * or are down, which could cause gateway groups to fail */
$gateways_arr = return_gateways_array();
foreach($gateways_arr as $gwitem) {
if(isset($gwitem['monitor_disable'])) {
@@ -308,13 +310,23 @@ function return_gateways_status($byname = false) {
else
$target = $tgtip;
- $status[$target]['monitorip'] = $tgtip;
- $status[$target]['srcip'] = $srcip;
- $status[$target]['name'] = $gwitem['name'];
- $status[$target]['lastcheck'] = date('r');
- $status[$target]['delay'] = "0.0ms";
- $status[$target]['loss'] = "0.0%";
- $status[$target]['status'] = "none";
+ /* failsafe for down interfaces */
+ if($target == "") {
+ $target = $gwitem['name'];
+ $status[$target]['name'] = $gwitem['name'];
+ $status[$target]['lastcheck'] = date('r');
+ $status[$target]['delay'] = "0.0ms";
+ $status[$target]['loss'] = "100.0%";
+ $status[$target]['status'] = "down";
+ } else {
+ $status[$target]['monitorip'] = $tgtip;
+ $status[$target]['srcip'] = $srcip;
+ $status[$target]['name'] = $gwitem['name'];
+ $status[$target]['lastcheck'] = date('r');
+ $status[$target]['delay'] = "0.0ms";
+ $status[$target]['loss'] = "0.0%";
+ $status[$target]['status'] = "none";
+ }
}
}
return($status);
@@ -705,7 +717,6 @@ function return_gateway_groups_array() {
unset($upgw, $dfltgwfound, $dfltgwdown, $gwname, $gwsttng);
}
-
if (is_array($config['gateways']['gateway_group'])) {
foreach($config['gateways']['gateway_group'] as $group) {
/* create array with group gateways members seperated by tier */
@@ -789,7 +800,10 @@ function return_gateway_groups_array() {
}
}
/* we should have the 1st available tier now, exit stage left */
- break;
+ if(is_array($gateway_groups_array[$group['name']]))
+ break;
+ else
+ log_error("GATEWAYS: We did not find the first tier of the gateway group {$group['name']}! That's odd.");
}
}
}
OpenPOWER on IntegriCloud