Improve handling of mark ranges

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2014-12-14 09:13:41 -08:00
parent 685825a336
commit 62f480897e

View File

@ -231,6 +231,12 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
my ( $option, $marktype ) = @_;
my $and_or = $params =~ s/^([|&])// ? $1 : '';
if ( $option ) {
$target = join( ' ', $target, $option );
} else {
$target = join( ' ', $target, $and_or eq '|' ? '--or-mark' : $and_or ? '--and-mark' : '--set-mark' );
}
if ( $params =~ /-/ ) {
#
# A Mark Range
@ -260,8 +266,6 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
$chain ||= $designator;
$chain ||= $default_chain;
$option = '--set-mark';
my $chainref = ensure_chain( 'mangle', $chain = $chainnames{$chain} );
for ( my $packet = 0; $packet < $marks; $packet++, $markval += $increment ) {
@ -286,7 +290,7 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
$source ,
$dest ,
'' ,
"$target $option " . join( '/', in_hex( $markval ) , $mask ) ,
join( ' ', $target, $option , join( '/', in_hex( $markval ) , $mask ) ) ,
'',
$target ,
$exceptionrule );
@ -317,12 +321,6 @@ sub process_mangle_rule1( $$$$$$$$$$$$$$$$$$ ) {
}
}
if ( $option ) {
$target = join( ' ', $target, $option );
} else {
$target = join( ' ', $target, $and_or eq '|' ? '--or-mark' : $and_or ? '--and-mark' : '--set-mark' );
}
( $mark, my $mask ) = split '/', $mark;
if ( supplied $mask ) {