diff options
author | Ermal <eri@pfsense.org> | 2010-04-30 14:32:25 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-04-30 14:32:25 +0000 |
commit | 5f53260a2da559c71a5de91dc5c6a332e664b24e (patch) | |
tree | ecc42481ed81b7349b47bdf5b45f3cfca3da08cc /etc/inc/filter.inc | |
parent | 05f3ffa431cf622828d311dd9b9b8ea49f9d1006 (diff) | |
download | pfsense-5f53260a2da559c71a5de91dc5c6a332e664b24e.zip pfsense-5f53260a2da559c71a5de91dc5c6a332e664b24e.tar.gz |
Allow for each gateway a weight to be choosen if the gateway has to be used in Gateway groups. This will create that many entries in the route-to statement as the weight says.
Diffstat (limited to 'etc/inc/filter.inc')
-rw-r--r-- | etc/inc/filter.inc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 51c88f9..f44482d 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -549,13 +549,14 @@ function filter_generate_gateways() { if (!is_ipaddr($gwip)) $gwip = get_interface_gateway($gateway['friendlyiface']); if (is_ipaddr($gwip) && !empty($int)) - $route = "route-to ( {$int} {$gwip} )\n"; + $route = "route-to ( {$int} {$gwip} )"; $rules .= "{$gwname} = \" {$route} \"\n"; } } - if(is_array($GatewayGroupsList)) { + if (is_array($GatewayGroupsList)) { foreach ($GatewayGroupsList as $gateway => $members) { + $route = ""; if (count($members) > 0) { $foundlb = 0; $routeto = ""; @@ -565,9 +566,10 @@ function filter_generate_gateways() { if (($int <> "") && is_ipaddr($gatewayip)) { if ($g['debug']) log_error("Setting up route with {$gatewayip} om $int"); - if ($idx > 1) - $routeto .= ", "; - $routeto .= "( {$int} {$gatewayip} ) "; + if ($member['weight'] > 1) { + $routeto .= str_repeat("( {$int} {$gatewayip} ) ", $member['weight']); + } else + $routeto .= "( {$int} {$gatewayip} ) "; $foundlb = 1; } else log_error("An error occurred while trying to find the interface got $gatewayip . The rule has not been added."); @@ -581,8 +583,8 @@ function filter_generate_gateways() { $route .= " sticky-address "; } } - $rules .= "{$gateway} = \" {$route} \"\n"; } + $rules .= "{$gateway} = \" {$route} \"\n"; } } |