From 99d89a378a4dd1a0aeb9acb5d1765c149387bee6 Mon Sep 17 00:00:00 2001 From: teastep Date: Thu, 3 May 2007 17:28:03 +0000 Subject: [PATCH] Improve editing of TOS values git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6219 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/Shorewall/Rules.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Shorewall-perl/Shorewall/Rules.pm b/Shorewall-perl/Shorewall/Rules.pm index 183b86d42..04a2da8f1 100644 --- a/Shorewall-perl/Shorewall/Rules.pm +++ b/Shorewall-perl/Shorewall/Rules.pm @@ -65,6 +65,12 @@ sub process_tos() { my $chain = $capabilities{MANGLE_FORWARD} ? 'fortos' : 'pretos'; 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' ) { my $first_entry = 1; @@ -83,6 +89,12 @@ sub process_tos() { 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 $restriction = NO_RESTRICT;