diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index aa1e128b7..b9aea45cd 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -1330,7 +1330,7 @@ sub ensure_accounting_chain( $$$ ) $chainref->{restriction} |= $restriction; } else { fatal_error "Chain name ($chain) too long" if length $chain > 29; - fatal_error "Invalid Chain name ($chain)" unless $chain =~ /^[-\w]+$/; + fatal_error "Invalid Chain name ($chain)" unless $chain =~ /^[-\w]+$/ && ! $builtin_target{$chain}; $chainref = new_chain 'filter' , $chain; $chainref->{accounting} = 1; $chainref->{referenced} = 1; @@ -1421,7 +1421,7 @@ sub new_nat_chain($) { sub new_manual_chain($) { my $chain = $_[0]; fatal_error "Chain name ($chain) too long" if length $chain > 29; - fatal_error "Invalid Chain name ($chain)" unless $chain =~ /^[-\w]+$/; + fatal_error "Invalid Chain name ($chain)" unless $chain =~ /^[-\w]+$/ && ! $builtin_target{$chain}; fatal_error "Duplicate Chain Name ($chain)" if $targets{$chain} || $filter_table->{$chain}; $targets{$chain} = CHAIN; ( my $chainref = ensure_filter_chain( $chain, 0) )->{manual} = 1;