diff options
author | Ermal Luçi <eri@pfsense.org> | 2009-05-01 16:05:45 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2009-05-01 16:05:45 +0000 |
commit | 53f4438b47e9293a4dfc5eac3aa3c0212b1c2f2b (patch) | |
tree | 3b3bbcaa6abf8e8714c5a17190358bd8bf292c7f /etc/inc | |
parent | de4757e244b22bc1cb8b617e10f5dc0031bcd349 (diff) | |
download | pfsense-53f4438b47e9293a4dfc5eac3aa3c0212b1c2f2b.zip pfsense-53f4438b47e9293a4dfc5eac3aa3c0212b1c2f2b.tar.gz |
Missed conversions.
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/filter.inc | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 14a2b5c..caa68ef 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -1062,26 +1062,26 @@ function generate_user_filter_rule_arr($rule) return $ret; } -function filter_generate_address(& $rule) +function filter_generate_address(& $rule, $target = "source") { global $FilterIflist; $src = ""; - if (isset($rule['source']['any'])) { + if (isset($rule[$target]['any'])) { $src = "any"; - } else if ($rule['source']['network']) { - if (strstr($rule['source']['network'], "opt")) { - $src = $FilterIflist[$rule['source']['network']]['sa'] . "/" . - $FilterIflist[$rule['source']['network']]['sn']; - if (isset($rule['source']['not'])) $src = " !{$src}"; + } else if ($rule[$target]['network']) { + if (strstr($rule[$target]['network'], "opt")) { + $src = $FilterIflist[$rule['source'][$target]]['sa'] . "/" . + $FilterIflist[$rule[$target]['network']]['sn']; + if (isset($rule[$target]['not'])) $src = " !{$src}"; /* check for opt$NUMip here */ $matches = ""; - if (preg_match("/opt([0-9999])ip/", $rule['source']['network'], $matches)) { + if (preg_match("/opt([0-9999])ip/", $rule[$target]['network'], $matches)) { $optnum = $matches[1]; $src = $FilterIflist["opt{$optnum}"]['ip']; } } else { - switch ($rule['source']['network']) { + switch ($rule[$target]['network']) { case 'wanip': $src = $FilterIflist["wan"]['ip']; break; @@ -1104,29 +1104,29 @@ function filter_generate_address(& $rule) $src = "{$pppoesa}/{$pppoesn}"; break; } - if (isset($rule['source']['not'])) $src = "!{$src}"; + if (isset($rule[$target]['not'])) $src = "!{$src}"; } - } else if ($rule['source']['address']) { - $expsrc = alias_expand($rule['source']['address']); - if (isset($rule['source']['not'])) + } else if ($rule[$target]['address']) { + $expsrc = alias_expand($rule[$target]['address']); + if (isset($rule[$target]['not'])) $not = "!"; else $not = ""; if (stristr($expsrc, "$")) { if($not) { $src = "{"; - foreach(preg_split("/[\s]+/", alias_expand_value($rule['source']['address'])) as $item) { + foreach(preg_split("/[\s]+/", alias_expand_value($rule[$target]['address'])) as $item) { if($item != "") { $src .= " {$not}{$item}"; } } /* added support for tables */ $src .= " 0/0 }"; - $src_table = "<not" . $rule['source']['address'] . ">"; + $src_table = "<not" . $rule[$target]['address'] . ">"; } else { - $src = "{ {$not} " . alias_expand_value($rule['source']['address']) . " } "; - $src_table = "<" . $rule['source']['address'] . ">"; + $src = "{ {$not} " . alias_expand_value($rule[$target]['address']) . " } "; + $src_table = "<" . $rule[$target]['address'] . ">"; } /* support for tables */ $src_table_line = "table $src_table {$src}\n"; @@ -1136,8 +1136,8 @@ function filter_generate_address(& $rule) } if (in_array($rule['protocol'], array("tcp","udp","tcp/udp"))) { - if ($rule['source']['port']) { - $srcport = explode("-", $rule['source']['port']); + if ($rule[$target]['port']) { + $srcport = explode("-", $rule[$target]['port']); if (alias_expand($srcport[0])) $srcporta = alias_expand($srcport[0]); else @@ -1361,7 +1361,7 @@ function generate_user_filter_rule($rule) update_filter_reload_status("Creating rule {$rule['descr']}"); /* source address */ - $src = filter_generate_address($rule); + $src = filter_generate_address($rule, "source"); if (empty($src) || ($src == "/")) return "# at the break!"; $aline['src'] = " from $src "; @@ -1371,7 +1371,7 @@ function generate_user_filter_rule($rule) $aline['os'] = " os {$rule['os']} "; /* destination address */ - $dst = filter_generate_address($rule); + $dst = filter_generate_address($rule, "destination"); if (empty($dst) || ($dst == "/")) return "# returning at dst $dst == \"/\""; $aline['dst'] = "to $dst "; |