aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiBa-NL <pba_2k3@yahoo.com>2014-12-22 00:57:37 +0100
committerPiBa-NL <pba_2k3@yahoo.com>2014-12-22 02:06:34 +0100
commit19145e4776cb85b467ab471e2baaeee2d023dd79 (patch)
treefca3c8b4851646f74335040e9bb5b5fc4414810b
parent40eb363a9851d8538adb9564d992e1ac6a276f07 (diff)
downloadpfsense-packages-19145e4776cb85b467ab471e2baaeee2d023dd79.tar.gz
pfsense-packages-19145e4776cb85b467ab471e2baaeee2d023dd79.tar.bz2
pfsense-packages-19145e4776cb85b467ab471e2baaeee2d023dd79.zip
haproxy-devel, fix frontend ipv4/ipv6 detection for usage in backend transparent_clientip
-rw-r--r--config/haproxy-devel/haproxy.inc15
1 files changed, 11 insertions, 4 deletions
diff --git a/config/haproxy-devel/haproxy.inc b/config/haproxy-devel/haproxy.inc
index 07086bd5..ecdefc58 100644
--- a/config/haproxy-devel/haproxy.inc
+++ b/config/haproxy-devel/haproxy.inc
@@ -544,7 +544,6 @@ function write_backend($configpath, $fd, $name, $pool, $frontend) {
$a_servers = &$pool['ha_servers']['item'];
$frontendtype = $frontend['type'];
- $frontend_ip = haproxy_interface_ip($frontend['extaddr']);
fwrite ($fd, "backend " . $name . "\n");
// https is an alias for tcp for clarity purposes
@@ -678,11 +677,19 @@ function write_backend($configpath, $fd, $name, $pool, $frontend) {
$pool['retries'] = 3;
fwrite ($fd, "\tretries\t\t\t" . $pool['retries'] . "\n");
+ $uses_ipv6 = false;
+ $ips = get_frontend_ipport($frontend);
+ foreach($ips as $ip){
+ $uses_ipv6 = is_ipaddrv6($ip['addr']);
+ if ($uses_ipv6)
+ break;
+ }
+
if ($pool['transparent_clientip']) {
- if (is_ipaddrv4($frontend_ip))
- fwrite ($fd, "\tsource 0.0.0.0 usesrc clientip\n");
- else
+ if ($uses_ipv6)
fwrite ($fd, "\tsource ipv6@ usesrc clientip\n");
+ else
+ fwrite ($fd, "\tsource 0.0.0.0 usesrc clientip\n");
}
$uri = $pool['monitor_uri'];