diff options
author | Bill Marquette <billm@pfsense.org> | 2006-06-25 18:54:07 +0000 |
---|---|---|
committer | Bill Marquette <billm@pfsense.org> | 2006-06-25 18:54:07 +0000 |
commit | f4e65a51ae3313bb60633f43ba90657724ce0546 (patch) | |
tree | ff79be02323fd0357e14bf5d680fb55478226407 | |
parent | deba957e569b065f266687986aa6bc3f3bdf55b0 (diff) | |
download | pfsense-packages-f4e65a51ae3313bb60633f43ba90657724ce0546.tar.gz pfsense-packages-f4e65a51ae3313bb60633f43ba90657724ce0546.tar.bz2 pfsense-packages-f4e65a51ae3313bb60633f43ba90657724ce0546.zip |
convert rule type testing to switch/case - easier to read than if/else/if...
-rw-r--r-- | packages/clamav.inc | 11 | ||||
-rw-r--r-- | packages/squid.inc | 11 |
2 files changed, 14 insertions, 8 deletions
diff --git a/packages/clamav.inc b/packages/clamav.inc index afbfbca3..2e83888c 100644 --- a/packages/clamav.inc +++ b/packages/clamav.inc @@ -229,14 +229,17 @@ function clamav_generate_rules($type) { $ifaces = explode(',', $clamav_conf['pop3_ifaces']); $ifaces = array_map('convert_friendly_interface_to_real_interface_name', $ifaces); - if ($type == 'nat') { + switch($type) { + case 'nat': foreach ($ifaces as $iface) $rules .= "rdr on $iface proto tcp to port pop3 -> 127.0.0.1 port 8110\n"; - } - - else { + break; + case 'filter': foreach ($ifaces as $iface) $rules .= "pass quick on $iface proto tcp to port pop3 flags S/SA keep state\n"; + break; + default: + break; } } diff --git a/packages/squid.inc b/packages/squid.inc index af0d7bda..670c8985 100644 --- a/packages/squid.inc +++ b/packages/squid.inc @@ -755,14 +755,17 @@ function squid_generate_rules($type) { $ifaces = explode(',', $squid_conf['active_interface']); $ifaces = array_map('convert_friendly_interface_to_real_interface_name', $ifaces); - if ($type == 'nat') { + switch($type) { + case 'nat': foreach ($ifaces as $iface) $rules .= "rdr on $iface inet proto tcp to !($iface) port 80 -> ($iface) port $port\n"; - } - - else { + break; + case 'filter': foreach ($ifaces as $iface) $rules .= "pass quick on $iface inet proto tcp to !($iface) port 80 flags S/SA keep state\n"; + break; + default: + break; } return $rules; |