diff options
author | Ermal <eri@pfsense.org> | 2010-10-22 21:47:03 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-10-22 21:47:03 +0000 |
commit | 98d75ad45d3b54fac8f111dcb2b3b9dea07f3263 (patch) | |
tree | b245d0317db645b902643f6f4722ae4aaadc71d0 /etc | |
parent | e4d79ab06e0193cb9f593d4544a3dce293f3beaf (diff) | |
download | pfsense-98d75ad45d3b54fac8f111dcb2b3b9dea07f3263.zip pfsense-98d75ad45d3b54fac8f111dcb2b3b9dea07f3263.tar.gz |
Be smart and correct; first check for opt*ip and after check for opt* otherwise it will never match the first case!
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/filter.inc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 01e37ce..2e53607 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -1510,17 +1510,17 @@ function filter_generate_address(& $rule, $target = "source", $isnat = false) { if(strstr($rule[$target]['network'], "opt")) { $optmatch = ""; $matches = ""; - if(preg_match("/opt([0-9]*)$/", $rule[$target]['network'], $optmatch)) { + /* check for opt$NUMip here */ + if (preg_match("/opt([0-9]*)ip/", $rule[$target]['network'], $matches)) { + $src = $FilterIflist["opt{$matches[1]}"]['ip']; + if(!is_ipaddr($src)) + return ""; + } else if (preg_match("/opt([0-9]*)$/", $rule[$target]['network'], $optmatch)) { $opt_ip = $FilterIflist["opt{$optmatch[1]}"]['ip']; if(!is_ipaddr($opt_ip)) return ""; $src = $opt_ip . "/" . $FilterIflist["opt{$optmatch[1]}"]['sn']; - /* check for opt$NUMip here */ - } else if(preg_match("/opt([0-9]*)ip/", $rule[$target]['network'], $matches)) { - $src = $FilterIflist["opt{$matches[1]}"]['ip']; - if(!is_ipaddr($src)) - return ""; } if(isset($rule[$target]['not'])) $src = " !{$src}"; @@ -1553,7 +1553,8 @@ function filter_generate_address(& $rule, $target = "source", $isnat = false) { $src = "{$pppoesa}/{$pppoesn}"; break; } - if(isset($rule[$target]['not'])) $src = "!{$src}"; + if(isset($rule[$target]['not'])) + $src = "!{$src}"; } } else if($rule[$target]['address']) { $expsrc = alias_expand($rule[$target]['address']); |