Remove superfluous logic from validate_portpari1()

- Add comments

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2018-01-19 12:46:52 -08:00
parent 4e6949f996
commit acd425a3c2
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10

View File

@ -874,6 +874,9 @@ sub validate_port( $$ ) {
fatal_error "Invalid/Unknown $proto port/service ($_[1])" unless defined $value;
}
#
# Port or port-pair separated by ':'. Either port may be omitted in the pair
#
sub validate_portpair( $$ ) {
my ($proto, $portpair) = @_;
my $what;
@ -914,15 +917,15 @@ sub validate_portpair( $$ ) {
}
#
# Port or port-pair separated by '-'. Neither port may be omitted in the pair
#
sub validate_portpair1( $$ ) {
my ($proto, $portpair) = @_;
my $what;
fatal_error "Invalid port range ($portpair)" if $portpair =~ tr/-/-/ > 1;
$portpair = "1$portpair" if substr( $portpair, 0, 1 ) eq ':';
$portpair = "${portpair}65535" if substr( $portpair, -1, 1 ) eq ':';
my @ports = split /-/, $portpair, 2;
my $protonum = resolve_proto( $proto ) || 0;