From 6dfd800f50d94f622033dffbbb288865c863d505 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 25 Jan 2005 20:42:58 +0000 Subject: [PATCH] Allow for tcp and udp on ports. Create a proto list in thise case. --- etc/inc/filter.inc | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 6d43582ec0..a26c9cea5e 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 */