diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-01-25 20:42:58 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-01-25 20:42:58 +0000 |
commit | 6dfd800f50d94f622033dffbbb288865c863d505 (patch) | |
tree | 9196b6c1b404660f8bf2e647e99f178bfc675b98 | |
parent | 52d62b6afdb781566e0866929f84091de82448a7 (diff) | |
download | pfsense-6dfd800f50d94f622033dffbbb288865c863d505.zip pfsense-6dfd800f50d94f622033dffbbb288865c863d505.tar.gz |
Allow for tcp and udp on ports. Create a proto list in thise case.
-rw-r--r-- | etc/inc/filter.inc | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 6d43582..a26c9ce 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -409,7 +409,10 @@ function filter_generate_altq_rules() { $line .= $interface; if (isset($rule['protocol'])) { - $line .= "proto {$rule['protocol']} "; + if($rule['protocol'] == "tcp/udp") + $line .= "proto { tcp udp } "; + else + $line .= "proto {$rule['protocol']} "; } else { if($rule['source']['port'] <> "" || $rule['destination']['port'] <> "") { $line .= "proto tcp "; @@ -746,12 +749,22 @@ function filter_nat_rules_generate() { $lanif = $lancfg['if']; if ((!$extport[1]) || ($extport[0] == $extport[1])) { - $natrules .= - "rdr on $natif proto " . $rule['protocol'] . " from any to any port {$extport[0]} -> {$target} \n"; + if($rule['protocol'] == "tcp/udp") + $natrules .= + "rdr on $natif proto { tcp udp } from any to any port {$extport[0]} -> {$target} \n"; + else + $natrules .= + "rdr on $natif proto " . $rule['protocol'] . " from any to any port {$extport[0]} -> {$target} \n"; + } else { - $natrules .= - "rdr on $natif proto " . $rule['protocol']. " from any to any port {$extport[0]}:{$extport[1]} " . - "-> {$target} \n"; + if($rule['protocol'] == "tcp/udp") + $natrules .= + "rdr on $natif proto { tcp udp } from any to any port {$extport[0]}:{$extport[1]} " . + "-> {$target} \n"; + else + $natrules .= + "rdr on $natif proto " . $rule['protocol']. " from any to any port {$extport[0]}:{$extport[1]} " . + "-> {$target} \n"; } $natrules .= "\n"; @@ -1186,9 +1199,21 @@ EOD; if ($ispptp) { $line .= "on ng" . ($iif+1) . " "; } + + //if($rule['protocol'] == "tcp/udp") + // $line .= "proto { tcp udp } "; + //else + // $line .= "proto {$rule['protocol']} "; if (isset($rule['protocol'])) { - $line .= "proto {$rule['protocol']} "; + if($rule['protocol'] == "tcp/udp") + $line .= "proto { tcp udp } "; + else + $line .= "proto {$rule['protocol']} "; + } else { + if($rule['source']['port'] <> "" || $rule['destination']['port'] <> "") { + $line .= "proto tcp "; + } } /* source address */ |