aboutsummaryrefslogtreecommitdiffstats
path: root/config/haproxy-devel/haproxy.inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2015-02-09 20:11:21 -0500
committerjim-p <jimp@pfsense.org>2015-02-09 20:11:21 -0500
commit7a051d65eba3b5b78911a55124e7985220916fb1 (patch)
treec5d0429201ffff68092cbb5209b61633e938c7ab /config/haproxy-devel/haproxy.inc
parent55b1712ee8e24b0f70efea8badab6ab7c50bc2d5 (diff)
parent5f8d58ffef12096558a0fb7a8b6a03f83a50bb06 (diff)
downloadpfsense-packages-7a051d65eba3b5b78911a55124e7985220916fb1.tar.gz
pfsense-packages-7a051d65eba3b5b78911a55124e7985220916fb1.tar.bz2
pfsense-packages-7a051d65eba3b5b78911a55124e7985220916fb1.zip
Merge pull request #815 from PiBa-NL/haproxy-devel_0_13
Diffstat (limited to 'config/haproxy-devel/haproxy.inc')
-rw-r--r--config/haproxy-devel/haproxy.inc22
1 files changed, 19 insertions, 3 deletions
diff --git a/config/haproxy-devel/haproxy.inc b/config/haproxy-devel/haproxy.inc
index cebe2a51..803d857e 100644
--- a/config/haproxy-devel/haproxy.inc
+++ b/config/haproxy-devel/haproxy.inc
@@ -472,7 +472,7 @@ function haproxy_install_cron($should_install) {
$cron_item['month'] = "*";
$cron_item['wday'] = "*";
$cron_item['who'] = "root";
- $cron_item['command'] = "/usr/local/etc/rc.d/haproxy.sh check";
+ $cron_item['command'] = "/usr/local/etc/rc.d/haproxy.sh onecheck";
$config['cron']['item'][] = $cron_item;
parse_config(true);
write_config("haproxy, install cron CARP job");
@@ -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