summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-06-14 16:39:01 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-06-14 16:39:01 -0700
commit3f37af7d2a0a90efbef1f576e9b47a1b630e6323 (patch)
tree20ef86c98810545a7d5f09592226f1f510807d1d /lib
parent6306f6edae447d824cf1d3beacb7b64f0f00d116 (diff)
downloadvyatta-cfg-qos-3f37af7d2a0a90efbef1f576e9b47a1b630e6323.tar.gz
vyatta-cfg-qos-3f37af7d2a0a90efbef1f576e9b47a1b630e6323.zip
Reject ip as a IP protocol value
The name ip exists in /etc/protocols as a pseudonym for all IP protocols. But the Qos match logic doesn't support it so do not allow the user to choose that value Bug 5689
Diffstat (limited to 'lib')
-rw-r--r--lib/Vyatta/Qos/Util.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Vyatta/Qos/Util.pm b/lib/Vyatta/Qos/Util.pm
index 9686120..8649a72 100644
--- a/lib/Vyatta/Qos/Util.pm
+++ b/lib/Vyatta/Qos/Util.pm
@@ -206,14 +206,18 @@ sub getProtocol {
defined $str or return;
if ( $str =~ /^([0-9]+)|(0x[0-9a-fA-F]+)$/ ) {
- if ( $str < 0 || $str > 255 ) {
+ if ( $str <= 0 || $str > 255 ) {
die "$str is not a valid protocol number\n";
}
return $str;
}
my ( $name, $aliases, $proto ) = getprotobyname($str);
- ( defined $proto ) or die "\"$str\" unknown protocol\n";
+ die "\"$str\" unknown protocol\n"
+ unless $proto;
+ die "$name is not usable as an IP protocol match\n"
+ if ($proto == 0);
+
return $proto;
}