mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-22 14:20:40 +01:00
Disallow :P in CLASSIFY rules and complain if :F is used when the SOURCE or DEST is $FW.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
2ca7984f60
commit
5b2f960db3
@ -104,8 +104,7 @@ my %flow_keys = ( 'src' => 1,
|
||||
'sk-gid' => 1,
|
||||
'vlan-tag' => 1 );
|
||||
|
||||
my %designator = ( P => 'tcpre' ,
|
||||
F => 'tcfor' ,
|
||||
my %designator = ( F => 'tcfor' ,
|
||||
T => 'tcpost' );
|
||||
|
||||
my %tosoptions = ( 'tos-minimize-delay' => '0x10/0x10' ,
|
||||
@ -212,6 +211,7 @@ sub process_tc_rule( ) {
|
||||
fatal_error "Invalid MARK ($originalmark)" unless supplied $mark;
|
||||
|
||||
my $chain = $globals{MARKING_CHAIN};
|
||||
my $classid = 0;
|
||||
|
||||
if ( $remainder ) {
|
||||
if ( $originalmark =~ /^\w+\(?.*\)$/ ) {
|
||||
@ -222,32 +222,39 @@ sub process_tc_rule( ) {
|
||||
$designator =~ /^([0-9a-fA-F]+)$/ &&
|
||||
( $chain = $designator{$remainder} ) );
|
||||
$mark = join( ':', $mark, $designator );
|
||||
$classid = 1;
|
||||
}
|
||||
}
|
||||
|
||||
my $target = 'MARK --set-mark';
|
||||
my $tcsref;
|
||||
my $connmark = 0;
|
||||
my $classid = 0;
|
||||
my $device = '';
|
||||
my $fw = firewall_zone;
|
||||
my $list;
|
||||
|
||||
if ( $source ) {
|
||||
if ( $source eq $fw ) {
|
||||
$chain = 'tcout';
|
||||
$source = '';
|
||||
if ( $classid ) {
|
||||
fatal_error ":F is not allowed when the SOURCE is the firewall" if $chain eq 'tcfor';
|
||||
} else {
|
||||
$chain = 'tcout' if $source =~ s/^($fw)://;
|
||||
$chain = 'tcout';
|
||||
}
|
||||
$source = '';
|
||||
} elsif ( $source =~ s/^($fw):// ) {
|
||||
fatal_error ":F is not allowed when the SOURCE is the firewall" if $chain eq 'tcfor';
|
||||
$chain = 'tcout';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $dest ) {
|
||||
if ( $dest eq $fw ) {
|
||||
fatal_error 'A CLASSIFY rule may not have $FW as the DEST' if $classid;
|
||||
$chain = 'tcin';
|
||||
$dest = '';
|
||||
} else {
|
||||
$chain = 'tcin' if $dest =~ s/^($fw)://;
|
||||
} elsif ( $dest =~ s/^($fw):// ) {
|
||||
fatal_error 'A CLASSIFY rule may not have $FW as the DEST' if $classid;
|
||||
$chain = 'tcin';
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,8 +275,9 @@ sub process_tc_rule( ) {
|
||||
require_capability ('CONNMARK' , "CONNMARK Rules", '' ) if $connmark;
|
||||
|
||||
} else {
|
||||
unless ( $remainder ) {
|
||||
unless ( $classid ) {
|
||||
fatal_error "Invalid MARK ($originalmark)" unless $mark =~ /^([0-9a-fA-F]+)$/ and $designator =~ /^([0-9a-fA-F]+)$/;
|
||||
fatal_error 'A CLASSIFY rule may not have $FW as the DEST' if $chain eq 'tcin';
|
||||
$chain = 'tcpost';
|
||||
$mark = $originalmark;
|
||||
}
|
||||
|
@ -216,19 +216,11 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>P</term>
|
||||
|
||||
<listitem>
|
||||
<para>PREROUTING chain.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>T</term>
|
||||
|
||||
<listitem>
|
||||
<para>POSTROUTING chain.</para>
|
||||
<para>POSTROUTING chain (default).</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
@ -216,19 +216,11 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>P</term>
|
||||
|
||||
<listitem>
|
||||
<para>PREROUTING chain.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>T</term>
|
||||
|
||||
<listitem>
|
||||
<para>POSTROUTING chain.</para>
|
||||
<para>POSTROUTING chain (default).</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
Loading…
Reference in New Issue
Block a user