Allow protocol to be expressed in octal or hex

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2010-01-16 14:20:47 -08:00
parent 8a6543af1b
commit 2e91a5ef43

View File

@ -287,7 +287,12 @@ sub resolve_proto( $ ) {
my $proto = $_[0];
my $number;
$proto =~ /^(\d+)$/ ? $proto <= 65535 ? $proto : undef : defined( $number = $nametoproto{$proto} ) ? $number : scalar getprotobyname $proto;
if ( $proto =~ /^\d+$/ || $proto =~ /^0x/ ) {
$number = numeric_value ( $proto );
defined $number && $number <= 65535 ? $number : undef;
} else {
defined( $number = $nametoproto{$proto} ) ? $number : scalar getprotobyname $proto;
}
}
sub proto_name( $ ) {