Fix service validation

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@8332 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2008-03-22 14:54:10 +00:00
parent 3bf59ff03a
commit 942d6bf6f5
2 changed files with 21 additions and 5 deletions

View File

@ -256,7 +256,7 @@ sub validate_port( $$ ) {
if ( $port =~ /^(\d+)$/ ) { if ( $port =~ /^(\d+)$/ ) {
return $port if $port <= 65535; return $port if $port <= 65535;
} else { } else {
$proto = getprotobyname $proto if $proto =~ /^(\d+)$/; $proto = getprotobynumber $proto if $proto =~ /^(\d+)$/;
$value = getservbyname( $port, $proto ); $value = getservbyname( $port, $proto );
} }

View File

@ -569,14 +569,28 @@ sub process_tc_filter( $$$$$$ ) {
" flowid $devref->{number}:$class" , " flowid $devref->{number}:$class" ,
'' ); '' );
} else { } else {
our $lastrule;
our $lasttnum;
# #
# In order to be able to access the protocol header, we must create another hash table and link to it. # In order to be able to access the protocol header, we must create another hash table and link to it.
# #
# Create the Table. # Create the Table.
# #
my $tnum = in_hex3 $devref->{tablenumber}++; my $tnum;
if ( $lastrule eq $rule ) {
#
# The source, dest and protocol are the same as the last rule that specified a port
# Use the same table
#
$tnum = $lasttnum
} else {
$tnum = in_hex3 $devref->{tablenumber}++;
$lasttnum = $tnum;
$lastrule = $rule;
emit( "\nrun_tc filter add dev $device parent $devnum:0 protocol ip pref 10 handle $tnum: u32 divisor 1" ); emit( "\nrun_tc filter add dev $device parent $devnum:0 protocol ip pref 10 handle $tnum: u32 divisor 1" );
}
# #
# And link to it using the current contents of $rule # And link to it using the current contents of $rule
# #
@ -664,6 +678,8 @@ sub process_tc_filter( $$$$$$ ) {
} }
sub setup_traffic_shaping() { sub setup_traffic_shaping() {
our $lastrule = '';
save_progress_message "Setting up Traffic Control..."; save_progress_message "Setting up Traffic Control...";
my $fn = open_file 'tcdevices'; my $fn = open_file 'tcdevices';