forked from extern/shorewall_code
Place a header in a created mangle file during update -t
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
55ab498291
commit
ab260dc5b1
@ -3240,6 +3240,34 @@ sub convert_tos($$) {
|
||||
}
|
||||
}
|
||||
|
||||
sub open_mangle_for_output() {
|
||||
my ( $mangle, $fn1 );
|
||||
|
||||
if ( -f ( find_file( 'mangle' ) ) ) {
|
||||
open( $mangle , '>>', $fn1 = find_file('mangle') ) || fatal_error "Unable to open $fn1:$!";
|
||||
} else {
|
||||
open( $mangle , '>', $fn1 = find_file('mangle') ) || fatal_error "Unable to open $fn1:$!";
|
||||
print $mangle <<'EOF';
|
||||
#
|
||||
# Shorewall version 4 - Mangle File
|
||||
#
|
||||
# For information about entries in this file, type "man shorewall-mangle"
|
||||
#
|
||||
# See http://shorewall.net/traffic_shaping.htm for additional information.
|
||||
# For usage in selecting among multiple ISPs, see
|
||||
# http://shorewall.net/MultiISP.html
|
||||
#
|
||||
# See http://shorewall.net/PacketMarking.html for a detailed description of
|
||||
# the Netfilter/Shorewall packet marking mechanism.
|
||||
####################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE USER TEST LENGTH TOS CONNBYTES HELPER PROBABILITY DSCP
|
||||
# PORT(S) PORT(S)
|
||||
EOF
|
||||
}
|
||||
|
||||
return ( $mangle, $fn1 );
|
||||
}
|
||||
|
||||
#
|
||||
# Process the mangle file and setup traffic shaping
|
||||
#
|
||||
@ -3304,7 +3332,7 @@ sub setup_tc( $ ) {
|
||||
#
|
||||
# We are going to convert this tcrules file to the equivalent mangle file
|
||||
#
|
||||
open( $mangle , '>>', $fn1 = find_file('mangle') ) || fatal_error "Unable to open $fn1:$!";
|
||||
( $mangle, $fn1 ) = open_mangle_for_output;
|
||||
|
||||
directive_callback( sub () { print $mangle "$_[1]\n" unless $_[0] eq 'FORMAT'; 0; } );
|
||||
}
|
||||
@ -3343,11 +3371,10 @@ sub setup_tc( $ ) {
|
||||
}
|
||||
|
||||
if ( -f ( my $fn = find_file( 'tos' ) ) ) {
|
||||
my $fn1;
|
||||
#
|
||||
# We are going to convert this tos file to the equivalent mangle file
|
||||
#
|
||||
open( $mangle , '>>', $fn1 = find_file('mangle') ) || fatal_error "Unable to open $fn1:$!";
|
||||
( $mangle, my $fn1 ) = open_mangle_for_output;
|
||||
convert_tos( $mangle, $fn1 );
|
||||
close $mangle;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user