aboutsummaryrefslogtreecommitdiffstats
path: root/config/haproxy-devel/haproxy.inc
diff options
context:
space:
mode:
authorPiBa-NL <pba_2k3@yahoo.com>2015-02-10 00:15:40 +0100
committerPiBa-NL <pba_2k3@yahoo.com>2015-02-10 00:18:41 +0100
commit5a1a2539145d42ec2cbe15ab6530148d021d18c8 (patch)
tree369be0a3d6f07a07b899f500db6721fd3b4b481f /config/haproxy-devel/haproxy.inc
parentcec43bb753d271b84aa6610315fdc02f784895c4 (diff)
downloadpfsense-packages-5a1a2539145d42ec2cbe15ab6530148d021d18c8.tar.gz
pfsense-packages-5a1a2539145d42ec2cbe15ab6530148d021d18c8.tar.bz2
pfsense-packages-5a1a2539145d42ec2cbe15ab6530148d021d18c8.zip
haproxy-devel, fix carp check settings for pfSense 2.2
Conflicts: config/haproxy-devel/haproxy_global.php
Diffstat (limited to 'config/haproxy-devel/haproxy.inc')
-rw-r--r--config/haproxy-devel/haproxy.inc20
1 files changed, 18 insertions, 2 deletions
diff --git a/config/haproxy-devel/haproxy.inc b/config/haproxy-devel/haproxy.inc
index fd4262a5..bc2b0ac8 100644
--- a/config/haproxy-devel/haproxy.inc
+++ b/config/haproxy-devel/haproxy.inc
@@ -1537,6 +1537,22 @@ function haproxy_plugin_certificates($pluginparams) {
return $result;
}
+function haproxy_carpipismaster($ip) {
+ global $config;
+ foreach($config['virtualip']['vip'] as $carp) {
+ if ($carp['mode'] != "carp")
+ continue;
+ $ipaddress = $carp['subnet'];
+ if ($ipaddress != $ip)
+ continue;
+
+ $carp_int = "{$carp['interface']}_vip{$carp['vhid']}";
+ $status = get_carp_interface_status($carp_int);
+ return ($status == "MASTER");
+ }
+ return null;
+}
+
function haproxy_check_run($reload) {
global $config, $g, $haproxy_run_message;
@@ -1549,8 +1565,8 @@ function haproxy_check_run($reload) {
if(isset($a_global['enable'])) {
if (isset($a_global['carpdev'])) {
- $status = get_carp_interface_status($a_global['carpdev']);
- if ($status != "MASTER") {
+ $status = haproxy_carpipismaster($a_global['carpdev']);
+ if (!$status) {
if (haproxy_is_running()) {
log_error("Stopping haproxy on CARP backup.");
//exec("/bin/pkill -F /var/run/haproxy.pid haproxy");//doesnt work for multiple pid's in a pidfile