Make reserved name illegal for Actions

This commit is contained in:
Tom Eastep 2011-02-18 17:44:14 -08:00
parent b4946dcf65
commit 011c90e6b8
2 changed files with 9 additions and 0 deletions

View File

@ -107,6 +107,7 @@ our %EXPORT_TAGS = (
ecn_chain
notrack_chain
first_chains
reserved_name
find_chain
ensure_chain
ensure_accounting_chain
@ -1130,6 +1131,12 @@ sub first_chains( $ ) #$1 = interface
( $c . '_fwd', $c . '_in' );
}
sub reserved_name( $ ) {
my $chain = shift;
$builtin_target{$chain} || $config_files{$chain} || $chain =~ /^account(?:fwd|in|ing|out)$/;
}
#
# Create a new chain and return a reference to it.
#

View File

@ -192,6 +192,8 @@ sub new_action( $$ ) {
my ( $action , $type ) = @_;
fatal_error "Invalid action name( $action)" if reserved_name( $action );
$actions{$action} = { actchain => '' };
$targets{$action} = $type;