mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-20 01:37:59 +02:00
Preserve shell variables when converting tcrules->mangle
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
1b82dedb77
commit
c5b393a074
@ -5139,50 +5139,50 @@ sub process_tc_rule( ) {
|
|||||||
my ( $originalmark, $source, $dest, $protos, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability , $dscp , $state );
|
my ( $originalmark, $source, $dest, $protos, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability , $dscp , $state );
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
( $originalmark, $source, $dest, $protos, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $probability, $dscp, $state ) =
|
( $originalmark, $source, $dest, $protos, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $probability, $dscp, $state ) =
|
||||||
split_line2( 'tcrules file',
|
split_rawline2( 'tcrules file',
|
||||||
{ mark => 0,
|
{ mark => 0,
|
||||||
action => 0,
|
action => 0,
|
||||||
source => 1,
|
source => 1,
|
||||||
dest => 2,
|
dest => 2,
|
||||||
proto => 3,
|
proto => 3,
|
||||||
dport => 4,
|
dport => 4,
|
||||||
sport => 5,
|
sport => 5,
|
||||||
user => 6,
|
user => 6,
|
||||||
test => 7,
|
test => 7,
|
||||||
length => 8,
|
length => 8,
|
||||||
tos => 9,
|
tos => 9,
|
||||||
connbytes => 10,
|
connbytes => 10,
|
||||||
helper => 11,
|
helper => 11,
|
||||||
probability => 12 ,
|
probability => 12 ,
|
||||||
scp => 13,
|
scp => 13,
|
||||||
state => 14 },
|
state => 14 },
|
||||||
{},
|
{},
|
||||||
15,
|
15,
|
||||||
1 );
|
1 );
|
||||||
$headers = '-';
|
$headers = '-';
|
||||||
} else {
|
} else {
|
||||||
( $originalmark, $source, $dest, $protos, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability, $dscp, $state ) =
|
( $originalmark, $source, $dest, $protos, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability, $dscp, $state ) =
|
||||||
split_line2( 'tcrules file',
|
split_rawline2( 'tcrules file',
|
||||||
{ mark => 0,
|
{ mark => 0,
|
||||||
action => 0,
|
action => 0,
|
||||||
source => 1,
|
source => 1,
|
||||||
dest => 2,
|
dest => 2,
|
||||||
proto => 3,
|
proto => 3,
|
||||||
dport => 4,
|
dport => 4,
|
||||||
sport => 5,
|
sport => 5,
|
||||||
user => 6,
|
user => 6,
|
||||||
test => 7,
|
test => 7,
|
||||||
length => 8,
|
length => 8,
|
||||||
tos => 9,
|
tos => 9,
|
||||||
connbytes => 10,
|
connbytes => 10,
|
||||||
helper => 11,
|
helper => 11,
|
||||||
headers => 12,
|
headers => 12,
|
||||||
probability => 13,
|
probability => 13,
|
||||||
dscp => 14,
|
dscp => 14,
|
||||||
state => 15 },
|
state => 15 },
|
||||||
{},
|
{},
|
||||||
16,
|
16,
|
||||||
1 );
|
1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
for my $proto (split_list( $protos, 'Protocol' ) ) {
|
for my $proto (split_list( $protos, 'Protocol' ) ) {
|
||||||
|
@ -2337,7 +2337,24 @@ sub setup_tc( $ ) {
|
|||||||
#
|
#
|
||||||
( $mangle, $fn1 ) = open_mangle_for_output( $fn );
|
( $mangle, $fn1 ) = open_mangle_for_output( $fn );
|
||||||
|
|
||||||
directive_callback( sub () { print $mangle "$_[1]\n" unless $_[0] eq 'FORMAT'; 0; } );
|
directive_callback(
|
||||||
|
sub ()
|
||||||
|
{
|
||||||
|
if ( $_[0] eq 'OMITTED' ) {
|
||||||
|
#
|
||||||
|
# Convert the raw rule
|
||||||
|
#
|
||||||
|
if ( $rawcurrentline =~ /^\s*(?:#.*)?$/ ) {
|
||||||
|
print $mangle "$_[1]\n";
|
||||||
|
} else {
|
||||||
|
process_tc_rule;
|
||||||
|
$have_tcrules++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print $mangle "$_[1]\n" unless $_[0] eq 'FORMAT';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
first_entry(
|
first_entry(
|
||||||
sub {
|
sub {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user