diff options
author | Ermal <eri@pfsense.org> | 2010-06-16 17:02:36 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-06-16 17:02:36 +0000 |
commit | 53824804f4c5ffb3c75838bf8235b979dfb650f5 (patch) | |
tree | a3e3540342dff1eeb8fa50be37352a8ff7b85cdf /etc | |
parent | ca94282988d0bfd74771e64a98aa542254cb878c (diff) | |
download | pfsense-53824804f4c5ffb3c75838bf8235b979dfb650f5.zip pfsense-53824804f4c5ffb3c75838bf8235b979dfb650f5.tar.gz |
Fixes #665. Optimize and correctly check for the gateways on static routes to be included on $tonatsubnets macro.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/filter.inc | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 0bbcf58..7ef9f32 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -1057,7 +1057,7 @@ function filter_nat_rules_generate_if($if, $src = "any", $srcport = "", $dst = " } function filter_nat_rules_generate() { - global $config, $g, $after_filter_configure_run, $FilterIflist; + global $config, $g, $after_filter_configure_run, $FilterIflist, $GatewaysList; $natrules = "nat-anchor \"natearly/*\"\n"; @@ -1145,16 +1145,13 @@ function filter_nat_rules_generate() { if(is_array($config['staticroutes']['route'])) { foreach ($config['staticroutes']['route'] as $route) { $netip = explode("/", $route['network']); - if(is_array($config['gateways']['gateway_item'])) { - foreach($config['gateways']['gateway_item'] as $gateway) { - if($route['gateway'] == $gateway['name']) { - $gatewayip = $gateway['gateway']; - $interfacegw = $gateway['interface']; - if((! interface_has_gateway($gateway['interface'])) && (is_private_ip($netip[0]))) { - $numberofnathosts++; - $tonathosts .= "{$route['network']} "; - } - } + if (isset($GatewaysList[$route['gateway']])) { + $gateway =& $GatewaysList[$route['gateway']]; + $gatewayip = $gateway['gateway']; + $interfacegw = $gateway['interface']; + if(!interface_has_gateway($gateway['interface']) && is_private_ip($netip[0])) { + $numberofnathosts++; + $tonathosts .= "{$route['network']} "; } } } |