summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2010-02-02 22:51:24 +0000
committerErmal Luçi <eri@pfsense.org>2010-02-02 22:51:24 +0000
commit0e0030e1919de6fdb810344f42915616cecc38b5 (patch)
tree6d9824f8562d911a64cf9d457bf21cfd9f3f7880
parent58507f896003f263ad1f6d84f00d13ac31170747 (diff)
downloadpfsense-0e0030e1919de6fdb810344f42915616cecc38b5.zip
pfsense-0e0030e1919de6fdb810344f42915616cecc38b5.tar.gz
Check if even the rule target is an alias, and expand it if so. Yet another fix to reflection.
-rw-r--r--etc/inc/filter.inc12
1 files changed, 10 insertions, 2 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index f1b8f0b..e235311 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -724,7 +724,7 @@ function filter_flush_state_table() {
return mwexec("/sbin/pfctl -F state");
}
-function filter_generate_reflection($rule, $target, $extport, &$starting_localhost_port, &$reflection_txt) {
+function filter_generate_reflection($rule, $extport, &$starting_localhost_port, &$reflection_txt) {
global $FilterIflist, $config;
// Initialize natrules holder string
@@ -759,6 +759,14 @@ function filter_generate_reflection($rule, $target, $extport, &$starting_localho
$extaddr = $rule['external-address'];
else if (is_ipaddr($FilterIflist[$rule['interface']]['ip']))
$extaddr = $FilterIflist[$rule['interface']]['ip'];
+
+ if (is_alias($rule['target'))
+ $target = filter_expand_alias($rule['target']);
+ else if(is_ipaddr($rule['target']))
+ $target = $rule['target'];
+ else if (is_ipaddr($FilterIflist[$rule['target']]['ip']))
+ $target = $FilterIflist[$rule['target']]['ip'];
+
if($rule['local-port'])
$lrange_start = $rule['local-port'];
if($range_end - $extport[0] > 500) {
@@ -1171,7 +1179,7 @@ function filter_nat_rules_generate() {
$natrules .= "nat on {$natif} proto tcp from {$rule_subnet}/{$rule_interface_subnet} to {$target} port {$extport[0]} -> ({$natif})\n";
}
}
- $natrules .= filter_generate_reflection($rule, $target, $extport, $starting_localhost_port, $reflection_rules);
+ $natrules .= filter_generate_reflection($rule, $extport, $starting_localhost_port, $reflection_rules);
$natrules .= "\n";
foreach ($reflection_rules as $txtline)
OpenPOWER on IntegriCloud