aboutsummaryrefslogtreecommitdiffstats
path: root/config/haproxy/haproxy.inc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2009-11-20 17:16:43 -0500
committerScott Ullrich <sullrich@pfsense.org>2009-11-20 17:16:43 -0500
commitadedc76777b0ac146abfd77f824369488f71005a (patch)
tree2bdbbb9cd565c699d28a3063e8ab9f2d78bf18f8 /config/haproxy/haproxy.inc
parentcd4f1d248b4dc41b122e8235245d0dda0f023692 (diff)
downloadpfsense-packages-adedc76777b0ac146abfd77f824369488f71005a.tar.gz
pfsense-packages-adedc76777b0ac146abfd77f824369488f71005a.tar.bz2
pfsense-packages-adedc76777b0ac146abfd77f824369488f71005a.zip
Allow specification of multiple ports seperated by a ,
Diffstat (limited to 'config/haproxy/haproxy.inc')
-rw-r--r--config/haproxy/haproxy.inc27
1 files changed, 20 insertions, 7 deletions
diff --git a/config/haproxy/haproxy.inc b/config/haproxy/haproxy.inc
index e3028e4c..97c5b5a1 100644
--- a/config/haproxy/haproxy.inc
+++ b/config/haproxy/haproxy.inc
@@ -123,13 +123,26 @@ function haproxy_configure() {
if(is_array($a_backends)) {
foreach ($a_backends as $backend) {
- if($backend['extaddr'] == "any")
- $listenip = "listen {$backend['name']}\t\t\t0.0.0.0:".$backend['port']."\n";
- elseif($backend['extaddr'])
- $listenip = "listen {$backend['name']}\t\t\t" . $backend['extaddr'] . ":" . $backend['port']."\n";
- else
- $listenip = "listen {$backend['name']}\t\t\t" . get_current_wan_address('wan').":" . $backend['port']."\n";
-
+ // Define our backend name
+ $backend = "listen {$backend['name']}\n";
+
+ // Prepare ports for processing by splitting
+ $backend['port'] .= ",";
+ $ports = split(",", $backend['port']);
+
+ // Process and add bind directives for ports
+ foreach($ports as $port) {
+ if($port) {
+ if($backend['extaddr'] == "any")
+ $listenip = "bind\t\t\t0.0.0.0:" . $port . "\n";
+ elseif($backend['extaddr'])
+ $listenip = "bind\t\t\t" . $backend['extaddr'] . ":" . $port ."\n";
+ else
+ $listenip = "bind\t\t\t" . get_current_wan_address('wan').":" . $port ."\n";
+ }
+ }
+
+ fwrite ($fd, "{$backend}");
fwrite ($fd, "{$listenip}");
fwrite ($fd, "\tmode\t\t\t".$backend['type'] . "\n");
fwrite ($fd, "\tlog\t\t\tglobal\n");