forked from extern/shorewall_code
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 );
|
||||
if ( $family == F_IPV4 ) {
|
||||
( $originalmark, $source, $dest, $protos, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $probability, $dscp, $state ) =
|
||||
split_line2( 'tcrules file',
|
||||
{ mark => 0,
|
||||
action => 0,
|
||||
source => 1,
|
||||
dest => 2,
|
||||
proto => 3,
|
||||
dport => 4,
|
||||
sport => 5,
|
||||
user => 6,
|
||||
test => 7,
|
||||
length => 8,
|
||||
tos => 9,
|
||||
connbytes => 10,
|
||||
helper => 11,
|
||||
probability => 12 ,
|
||||
scp => 13,
|
||||
state => 14 },
|
||||
{},
|
||||
15,
|
||||
1 );
|
||||
split_rawline2( 'tcrules file',
|
||||
{ mark => 0,
|
||||
action => 0,
|
||||
source => 1,
|
||||
dest => 2,
|
||||
proto => 3,
|
||||
dport => 4,
|
||||
sport => 5,
|
||||
user => 6,
|
||||
test => 7,
|
||||
length => 8,
|
||||
tos => 9,
|
||||
connbytes => 10,
|
||||
helper => 11,
|
||||
probability => 12 ,
|
||||
scp => 13,
|
||||
state => 14 },
|
||||
{},
|
||||
15,
|
||||
1 );
|
||||
$headers = '-';
|
||||
} else {
|
||||
( $originalmark, $source, $dest, $protos, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability, $dscp, $state ) =
|
||||
split_line2( 'tcrules file',
|
||||
{ mark => 0,
|
||||
action => 0,
|
||||
source => 1,
|
||||
dest => 2,
|
||||
proto => 3,
|
||||
dport => 4,
|
||||
sport => 5,
|
||||
user => 6,
|
||||
test => 7,
|
||||
length => 8,
|
||||
tos => 9,
|
||||
connbytes => 10,
|
||||
helper => 11,
|
||||
headers => 12,
|
||||
probability => 13,
|
||||
dscp => 14,
|
||||
state => 15 },
|
||||
{},
|
||||
16,
|
||||
1 );
|
||||
split_rawline2( 'tcrules file',
|
||||
{ mark => 0,
|
||||
action => 0,
|
||||
source => 1,
|
||||
dest => 2,
|
||||
proto => 3,
|
||||
dport => 4,
|
||||
sport => 5,
|
||||
user => 6,
|
||||
test => 7,
|
||||
length => 8,
|
||||
tos => 9,
|
||||
connbytes => 10,
|
||||
helper => 11,
|
||||
headers => 12,
|
||||
probability => 13,
|
||||
dscp => 14,
|
||||
state => 15 },
|
||||
{},
|
||||
16,
|
||||
1 );
|
||||
}
|
||||
|
||||
for my $proto (split_list( $protos, 'Protocol' ) ) {
|
||||
|
@ -2337,7 +2337,24 @@ sub setup_tc( $ ) {
|
||||
#
|
||||
( $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(
|
||||
sub {
|
||||
|
Loading…
Reference in New Issue
Block a user