summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-04-19 01:21:34 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-04-19 01:21:34 +0000
commit9440aff3a04d9ed1f15961f3cafed41019a1594f (patch)
treeb9a9e18144c6d414fcd0d726fcedd9729edbe34b /etc
parentbd7a3f8cefeab7306f917dd2ad78232f05333318 (diff)
downloadpfsense-9440aff3a04d9ed1f15961f3cafed41019a1594f.zip
pfsense-9440aff3a04d9ed1f15961f3cafed41019a1594f.tar.gz
MFC 11600
Only setup route-to {} syntax if at least one available gateway was found
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/filter.inc11
1 files changed, 7 insertions, 4 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index 665c97f..dfc1e59 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -1194,6 +1194,7 @@ function generate_user_filter_rule($rule, $ngcounter) {
/* if user has selected a custom gateway, lets work with it */
if($rule['gateway'] <> "") {
$foundlb = 0;
+ $routeto = " route-to { ";
if(is_array($config['load_balancer']['lbpool'])) {
foreach($config['load_balancer']['lbpool'] as $lb) {
update_filter_reload_status("Creating load balancing item...");
@@ -1212,7 +1213,6 @@ function generate_user_filter_rule($rule, $ngcounter) {
continue;
}
}
- $line .= " route-to { ";
/* if /tmp/$lbname.pool exists then read in our gateway hints from slbd */
if(file_exists("{$g['tmp_path']}/{$lb['name']}.pool")) {
$lbs = split("\n", file_get_contents("{$g['tmp_path']}/{$lb['name']}.pool"));
@@ -1232,18 +1232,21 @@ function generate_user_filter_rule($rule, $ngcounter) {
}
}
if($foundlb == 1)
- $line .= ", ";
+ $routeto .= ", ";
/* determine interface from gateway address */
$int = guess_interface_from_ip($gateway);
- $line .= "( {$int} {$gateway} ) ";
+ $routeto .= "( {$int} {$gateway} ) ";
if($int == "") {
$line = "# error resolving load balancing {$gateway}";
}
$foundlb = 1;
}
- $line .= "} round-robin ";
+ $routeto .= "} round-robin ";
}
}
+ /* Add the load balanced gateways */
+ if ($foundlb = 1)
+ $line .= $routeto;
}
/* we're not using load balancing, just setup gateway */
if($foundlb == 0) {
OpenPOWER on IntegriCloud