Improve editing of TOS values

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6219 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-05-03 17:28:03 +00:00
parent 45c8d39a1b
commit 99d89a378a

View File

@ -65,6 +65,12 @@ sub process_tos() {
my $chain = $capabilities{MANGLE_FORWARD} ? 'fortos' : 'pretos'; my $chain = $capabilities{MANGLE_FORWARD} ? 'fortos' : 'pretos';
my $stdchain = $capabilities{MANGLE_FORWARD} ? 'FORWARD' : 'PREROUTING'; my $stdchain = $capabilities{MANGLE_FORWARD} ? 'FORWARD' : 'PREROUTING';
my %tosoptions = ( 'minimize-delay' => 0x10 ,
'maximize-throughput' => 0x08 ,
'maximize-reliability' => 0x04 ,
'minimize-cost' => 0x02 ,
'normal-service' => 0x00 );
if ( my $fn = open_file 'tos' ) { if ( my $fn = open_file 'tos' ) {
my $first_entry = 1; my $first_entry = 1;
@ -83,6 +89,12 @@ sub process_tos() {
fatal_error "TOS field required" unless $tos ne '-'; fatal_error "TOS field required" unless $tos ne '-';
if ( defined ( my $tosval = $tosoptions{"\L$tos"} ) ) {
$tos = $tosval;
} elsif ( numeric_value( $tos ) > 0x1e ) {
fatal_error "Invalid TOS value";
}
my $chainref; my $chainref;
my $restriction = NO_RESTRICT; my $restriction = NO_RESTRICT;