summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Qos/Match.pm
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-28 09:50:35 -0700
commitdde3326d94a99b509853355f6cea5f2ab513cded (patch)
tree8b0ccd7c4403494716d4c90cd7f52f128c5b2bb4 /lib/Vyatta/Qos/Match.pm
parent89e5660652943e59c8f687100973c37aa1113868 (diff)
downloadvyatta-cfg-qos-dde3326d94a99b509853355f6cea5f2ab513cded.tar.gz
vyatta-cfg-qos-dde3326d94a99b509853355f6cea5f2ab513cded.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. (cherry picked from commit 5ad6cc5026cd19cf994dd0670db4d0fa31f9010b)
Diffstat (limited to 'lib/Vyatta/Qos/Match.pm')
-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;