From 95bd5c86c823fa2e04be537f176c2b780ab2864b Mon Sep 17 00:00:00 2001 From: Ermal Date: Thu, 29 Apr 2010 16:12:08 +0000 Subject: Always generate macros so ruleset does not fail even when the gateway has no members. --- etc/inc/filter.inc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'etc') diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 62982e5..51c88f9 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -545,10 +545,12 @@ function filter_generate_gateways() { foreach ($GatewaysList as $gwname => $gateway) { $int = $gateway['interface']; $gwip = $gateway['gateway']; + $route = ""; if (!is_ipaddr($gwip)) $gwip = get_interface_gateway($gateway['friendlyiface']); if (is_ipaddr($gwip) && !empty($int)) - $rules .= "{$gwname} = \" route-to ( {$int} {$gwip} ) \"\n"; + $route = "route-to ( {$int} {$gwip} )\n"; + $rules .= "{$gwname} = \" {$route} \"\n"; } } @@ -570,6 +572,7 @@ function filter_generate_gateways() { } else log_error("An error occurred while trying to find the interface got $gatewayip . The rule has not been added."); } + $route = ""; if ($foundlb > 0) { $route = " route-to { {$routeto} } "; if ($idx > 1) { @@ -577,8 +580,8 @@ function filter_generate_gateways() { if (isset($config['system']['lb_use_sticky'])) $route .= " sticky-address "; } - $rules .= "{$gateway} = \" {$route} \"\n"; } + $rules .= "{$gateway} = \" {$route} \"\n"; } } } -- cgit v1.1