summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-07-27 10:56:55 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-07-27 10:56:55 -0700
commit5ad6cc5026cd19cf994dd0670db4d0fa31f9010b (patch)
treea1c68c85b581d941a718e2ad62ac02dfcc2063e0
parentb5f5d0884bf9e6222924f0b5177d1876a2167a8f (diff)
downloadvyatta-cfg-qos-5ad6cc5026cd19cf994dd0670db4d0fa31f9010b.tar.gz
vyatta-cfg-qos-5ad6cc5026cd19cf994dd0670db4d0fa31f9010b.zip
Fix problem with port interpretation if protocol specified
Bug 5924 If ip protocol match was specified but no port match then the code would incorrectly call getPort (undef, "tcp") which gets interpreted as getPort("tcp") by Perl and causes error.
-rw-r--r--lib/Vyatta/Qos/Match.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Vyatta/Qos/Match.pm b/lib/Vyatta/Qos/Match.pm
index b2b13da..50e20f1 100644
--- a/lib/Vyatta/Qos/Match.pm
+++ b/lib/Vyatta/Qos/Match.pm
@@ -58,12 +58,14 @@ sub new {
$fields{dsfield} = getDsfield( $config->returnValue("$af dscp") );
my $ipprot = $config->returnValue("$af protocol");
$fields{protocol} = getProtocol($ipprot);
+
$fields{src} = $config->returnValue("$af source address");
$fields{dst} = $config->returnValue("$af destination address");
- $fields{sport} =
- getPort( $config->returnValue("$af source port"), $ipprot );
- $fields{dport} =
- getPort( $config->returnValue("$af destination port"), $ipprot );
+
+ my $port = $config->returnValue("$af source port");
+ $fields{sport} = getPort( $port, $ipprot ) if $port;
+ $port = $config->returnValue("$af destination port");
+ $fields{dport} = getPort( $port, $ipprot ) if $port;
}
$self->{$af} = \%fields;