forked from extern/shorewall_code
Allow override of :syn assumption in CT rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
46f68c6dcb
commit
078c781dfa
@ -4782,6 +4782,7 @@ sub do_proto( $$$;$ )
|
||||
if ( $proto ne '' ) {
|
||||
|
||||
my $synonly = ( $proto =~ s/:(!)?syn$//i );
|
||||
my $all = ( $proto =~ s/:all$//i );
|
||||
my $notsyn = $1;
|
||||
my $invert = ( $proto =~ s/^!// ? '! ' : '' );
|
||||
my $protonum = resolve_proto $proto;
|
||||
@ -4797,6 +4798,7 @@ sub do_proto( $$$;$ )
|
||||
# $proto now contains the protocol number and $pname contains the canonical name of the protocol
|
||||
#
|
||||
unless ( $synonly ) {
|
||||
fatal_error '":all" is only allowed with tcp' if $all && $proto != TCP;
|
||||
$output = "${invert}-p ${proto} ";
|
||||
} else {
|
||||
fatal_error '":syn" is only allowed with tcp' unless $proto == TCP && ! $invert;
|
||||
@ -4992,6 +4994,7 @@ sub do_iproto( $$$ )
|
||||
if ( $proto ne '' ) {
|
||||
|
||||
my $synonly = ( $proto =~ s/:syn$//i );
|
||||
my $all = ( $proto =~ s/:all$//i );
|
||||
my $invert = ( $proto =~ s/^!// ? '! ' : '' );
|
||||
my $protonum = resolve_proto $proto;
|
||||
|
||||
@ -5006,6 +5009,7 @@ sub do_iproto( $$$ )
|
||||
# $proto now contains the protocol number and $pname contains the canonical name of the protocol
|
||||
#
|
||||
unless ( $synonly ) {
|
||||
fatal_error '":all" is only allowed with tcp' if $all && $proto != TCP;
|
||||
@output = ( p => "${invert}${proto}" );
|
||||
} else {
|
||||
fatal_error '":syn" is only allowed with tcp' unless $proto == TCP && ! $invert;
|
||||
|
@ -138,7 +138,11 @@ sub process_conntrack_rule( $$$$$$$$$$ ) {
|
||||
|
||||
require_capability 'CT_TARGET', 'CT entries in the conntrack file', '';
|
||||
|
||||
$proto = TCP . ':syn' if $proto !~ /:syn$/ && resolve_proto( $proto ) == TCP;
|
||||
if ( $proto =~ s/:all$// ) {
|
||||
fatal_error '":all" may only be used with TCP' unless resolve_proto( $proto ) == TCP;
|
||||
} else {
|
||||
$proto = TCP . ':syn' if $proto !~ /:syn/ && resolve_proto( $proto ) == TCP;
|
||||
}
|
||||
|
||||
if ( $option eq 'notrack' ) {
|
||||
fatal_error "Invalid conntrack ACTION ( $action )" if supplied $args;
|
||||
|
@ -579,14 +579,23 @@
|
||||
|
||||
<listitem>
|
||||
<para>A protocol name from <filename>/etc/protocols</filename> or a
|
||||
protocol number.</para>
|
||||
protocol number. tcp and 6 may be optionally followed by <emphasis
|
||||
role="bold">:syn </emphasis>to match only the SYN packet (first
|
||||
packet in the three-way handshake).</para>
|
||||
|
||||
<para>Beginning with Shorewall 4.5.12, this column is labeled
|
||||
<emphasis role="bold">PROTOS</emphasis> and can accept a
|
||||
comma-separated list of protocols. Either <emphasis
|
||||
<para>Beginning with Shorewall 4.5.12, this column can accept a
|
||||
comma-separated list of protocols and either <emphasis
|
||||
role="bold">proto</emphasis> or <emphasis
|
||||
role="bold">protos</emphasis> is accepted in the alternate input
|
||||
format.</para>
|
||||
|
||||
<para>Beginning with Shorewall 5.1.11, when <emphasis
|
||||
role="bold">tcp</emphasis> or <emphasis role="bold">6</emphasis> is
|
||||
specified and the ACTION is <emphasis role="bold">CT</emphasis>, the
|
||||
compiler will default to <emphasis role="bold">:syn</emphasis>. If
|
||||
you wish the rule to match packets with any valid combination of TCP
|
||||
flags, you may specify <emphasis role="bold">tcp:all</emphasis> or
|
||||
<emphasis role="bold">6:all</emphasis>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user