diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2007-08-22 20:07:47 +0000 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2007-08-22 20:07:47 +0000 |
commit | 6bc448417b11008f703ca16a5b3f9b50d50a2ece (patch) | |
tree | e982dab333be4e439ce7cfb25d934838ab6b5991 | |
parent | 94f01c71bfb7eb06fb713f52dbe658e16dd772c3 (diff) | |
download | pfsense-6bc448417b11008f703ca16a5b3f9b50d50a2ece.zip pfsense-6bc448417b11008f703ca16a5b3f9b50d50a2ece.tar.gz |
Negate local networks as well. It's required for proper operation after all
MFC: Perhaps, fixes existing ticket with regards to load balancer rules
-rw-r--r-- | etc/inc/filter.inc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 45d2006..5892a7f 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2077,6 +2077,31 @@ function generate_user_filter_rule($rule, $ngcounter) { $aline['src'] . $aline['srcport'] . $aline['os'] . $vpns . $aline['dstport']. $aline['icmp-type'] . $aline['flags'] . " label \"NEGATE_ROUTE: Negate policy route for local network(s)\"\n"; + /* if list */ + $iflist = array("lan", "wan"); + for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) + $iflist['opt' . $i] = "opt{$i}"; + /* build local networks list */ + $localnets = "to { "; + foreach ($iflist as $ifent => $ifname) { + if(stristr($ifname, "opt")) { + if(!isset($config['interfaces'][$ifname]['enable'])) { + continue; + } + } + /* do not process interfaces that will end up with gateways */ + if(! interface_has_gateway($ifname)) { + $sa = gen_subnet($config['interfaces'][$ifname]['ipaddr'], $config['interfaces'][$ifname]['subnet']); + $sn = $config['interfaces'][$ifname]['subnet']; + $localnets .= "{$sa}/{$sn} "; + } + } + $localnets .= " } "; + /* return the line */ + $line .= $aline['type'] . $aline['direction'] . $aline['log'] . $aline['quick'] . $aline['interface'] . $aline['prot'] . + $aline['src'] . $aline['srcport'] . $aline['os'] . $localnets . $aline['dstport']. + $aline['icmp-type'] . $aline['flags'] . + " label \"NEGATE_ROUTE: Negate policy route for local network(s)\"\n"; } /* piece together the actual user rule */ |