diff --git a/Shorewall/Perl/Shorewall/Zones.pm b/Shorewall/Perl/Shorewall/Zones.pm index 3b07f16a0..e19c7fbc8 100644 --- a/Shorewall/Perl/Shorewall/Zones.pm +++ b/Shorewall/Perl/Shorewall/Zones.pm @@ -763,6 +763,13 @@ sub add_group_to_zone($$$$$) $new = \@exclusions; } + if ( substr( $host, 0, 1 ) eq '+' ) { + fatal_error "Invalid ipset name ($host)" unless $host =~ /^\+(6_)?[a-zA-Z][-\w]*$/; + require_capability( 'IPSET_MATCH', 'Ipset names in host lists', ''); + } else { + $host = validate_host $host, 0; + } + unless ( $switched ) { if ( $type == $zonetype ) { fatal_error "Duplicate Host Group ($interface:$host) in zone $zone" if $interfaces{$interface}{zone} eq $zone; @@ -781,13 +788,6 @@ sub add_group_to_zone($$$$$) } } - if ( substr( $host, 0, 1 ) eq '+' ) { - fatal_error "Invalid ipset name ($host)" unless $host =~ /^\+(6_)?[a-zA-Z][-\w]*$/; - require_capability( 'IPSET_MATCH', 'Ipset names in host lists', ''); - } else { - $host = validate_host $host, 0; - } - push @$new, $host; }