diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2006-03-17 22:08:25 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2006-03-17 22:08:25 +0000 |
commit | 2f038c0b12ebeed6677fb8c1c3455a493cdf66c2 (patch) | |
tree | ba68d27c5c1353e9c4eabf91acc035e23e8fcfab /etc/inc | |
parent | fdba8ba0962ff9f94785662f164b697e324aab2c (diff) | |
download | pfsense-2f038c0b12ebeed6677fb8c1c3455a493cdf66c2.zip pfsense-2f038c0b12ebeed6677fb8c1c3455a493cdf66c2.tar.gz |
MFC 10668
expand aliases to include " ! " to negate all entries in a list.
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/shaper.inc | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/etc/inc/shaper.inc b/etc/inc/shaper.inc index 00184e7..b794e48 100644 --- a/etc/inc/shaper.inc +++ b/etc/inc/shaper.inc @@ -470,7 +470,29 @@ function filter_generate_pf_altq_rules() { } if (isset($rule['source']['not'])) { - $src = "!{$src}"; + + /*pf is not really happy with this sexy ($src = "!{$src}";) approach of + * negating a list or macro. So we have to write out a ! on each entry. + */ + + /* not very happy with this! but it beats copying this section to + * several places. + */ + $alias = alias_expand(substr($src, 1)); + + if(isset($alias) && stristr($alias, "$")) { + $alias = alias_expand_value(substr($src, 1)); + $src = "{"; + foreach(preg_split("/[\s]+/", $alias) as $item) { + if($item != "") { + $src .= " !{$item}"; + } + } + $src .= " }"; + } + else { + $src = "!{$src}"; + } } $line .= "from {$src} "; @@ -531,7 +553,29 @@ function filter_generate_pf_altq_rules() { } if (isset($rule['destination']['not'])) { - $dst = "!{$dst}"; + + /*pf is not really happy with this sexy ($dst = "!{$dst}";) approach of + * negating a list or macro. So we have to write out a ! on each entry. + */ + + /* not very happy with this! but it beats copying this section to + * several places. + */ + $alias = alias_expand(substr($dst, 1)); + + if(isset($alias) && stristr($alias, "$")) { + $alias = alias_expand_value(substr($dst, 1)); + $dst = "{"; + foreach(preg_split("/[\s]+/", $alias) as $item) { + if($item != "") { + $dst .= " !{$item}"; + } + } + $dst .= " }"; + } + else { + $dst = "!{$dst}"; + } } $line .= "to {$dst} "; |