From ee998ee16fd508a9688b86df49c8fde43e4427e3 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 7 Aug 2005 01:38:52 +0000 Subject: Add outgoing load balancing --- etc/inc/filter.inc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index f22c1a9..a7693b1 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -1342,8 +1342,23 @@ function generate_user_filter_rule($rule, $ngcounter) { /* if user has selected a custom gateway, lets work with it */ if($rule['gateway'] <> "") { - $int = guess_interface_from_ip($rule['gateway']); - $line .= " route-to (" . $int . " " . $rule['gateway'] . ") "; + $foundlb = 0; + foreach($config['load_balancer']['lbpool'] as $lb) { + if($lb['name'] == $rule['gateway']) { + $servers = ""; + /* XXX: when slbd writes out helper file, + * simply read in and feed to route-to + */ + foreach($lb['servers'] as $server) { + $servers .= $server . " "; + } + $line .= " route-to (" . $int . " " . $servers . ") "; + } + } + if($foundlb == 0) { + $int = guess_interface_from_ip($rule['gateway']); + $line .= " route-to (" . $int . " " . $rule['gateway'] . ") "; + } } /* Setup outgoing load balancing */ -- cgit v1.1