mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-19 17:28:35 +02:00
Place a header in a created mangle file during update -t
Signed-off-by: Tom Eastep <teastep@shorewall.net> Conflicts: Shorewall/Perl/Shorewall/Tc.pm
This commit is contained in:
parent
5a6586e06c
commit
c77d18965a
@ -3214,6 +3214,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
|
# Process the mangle file and setup traffic shaping
|
||||||
#
|
#
|
||||||
@ -3278,7 +3306,7 @@ sub setup_tc( $ ) {
|
|||||||
#
|
#
|
||||||
# We are going to convert this tcrules file to the equivalent mangle file
|
# 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; } );
|
directive_callback( sub () { print $mangle "$_[1]\n" unless $_[0] eq 'FORMAT'; 0; } );
|
||||||
|
|
||||||
@ -3319,7 +3347,7 @@ sub setup_tc( $ ) {
|
|||||||
#
|
#
|
||||||
# We are going to convert this tosfile to the equivalent mangle file
|
# We are going to convert this tosfile 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 );
|
convert_tos( $mangle, $fn1 );
|
||||||
close $mangle;
|
close $mangle;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user