Implement tcp:!syn in PROTO column

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2017-03-07 10:33:20 -08:00
parent cd103bb715
commit f1d1ab6411
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10
2 changed files with 5 additions and 2 deletions

View File

@ -4556,7 +4556,8 @@ sub do_proto( $$$;$ )
if ( $proto ne '' ) {
my $synonly = ( $proto =~ s/:syn$//i );
my $synonly = ( $proto =~ s/:(!)?syn$//i );
my $notsyn = $1;
my $invert = ( $proto =~ s/^!// ? '! ' : '' );
my $protonum = resolve_proto $proto;
@ -4574,7 +4575,7 @@ sub do_proto( $$$;$ )
$output = "${invert}-p ${proto} ";
} else {
fatal_error '":syn" is only allowed with tcp' unless $proto == TCP && ! $invert;
$output = "-p $proto --syn ";
$output = $notsyn ? "-p $proto ! --syn" : "-p $proto --syn ";
}
fatal_error "SOURCE/DEST PORT(S) not allowed with PROTO !$pname" if $invert && ($ports ne '' || $sports ne '');

View File

@ -389,6 +389,8 @@ sub resolve_proto( $ ) {
my $proto = $_[0];
my $number;
$proto =~ s/:.*//;
if ( $proto =~ /^\d+$/ || $proto =~ /^0x/ ) {
$number = numeric_value ( $proto );
defined $number && $number <= 255 ? $number : undef;