aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorthompsa <andy@fud.org.nz>2010-02-08 13:20:34 +1300
committerthompsa <andy@fud.org.nz>2010-02-08 13:20:34 +1300
commitba976e783054c7e8d5d1c22f95684bb98088f124 (patch)
tree974dd8c8ae59f19c96c630b0bad660ef0c42fe48 /config
parenta0da2cb16356f9ec70d8d0cb7cd6c077a863813c (diff)
downloadpfsense-packages-ba976e783054c7e8d5d1c22f95684bb98088f124.tar.gz
pfsense-packages-ba976e783054c7e8d5d1c22f95684bb98088f124.tar.bz2
pfsense-packages-ba976e783054c7e8d5d1c22f95684bb98088f124.zip
Provide a fallback if both the pool and listener do not supply port
numbers.
Diffstat (limited to 'config')
-rw-r--r--config/haproxy-dev/haproxy.inc9
1 files changed, 8 insertions, 1 deletions
diff --git a/config/haproxy-dev/haproxy.inc b/config/haproxy-dev/haproxy.inc
index ba39e5c9..b5f62c4f 100644
--- a/config/haproxy-dev/haproxy.inc
+++ b/config/haproxy-dev/haproxy.inc
@@ -271,8 +271,15 @@ function haproxy_configure() {
$checkinter = "check inter 1000";
$a_servers = &$pool['ha_servers']['item'];
foreach($a_servers as $be) {
- if(!$be['port'])
+ if(!$be['port']) {
+ // the listener can specify a default port
$be['port'] = $backend['svrport'];
+ }
+ if(!$be['port']) {
+ // last resort, use the frontend port
+ $ports = split(",", "{$backend['port']},");
+ $be['port'] = $ports[0];
+ }
if (!$be['name'])
$be['name'] = $be['address'];
fwrite ($fd, "\tserver\t\t\t" . $be['name'] . " " . $be['address'].":" . $be['port'] . " $cookie " . " $checkinter weight " . $be['weight'] . "{$advanced_txt}\n");