From dde3326d94a99b509853355f6cea5f2ab513cded Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 27 Jul 2010 10:56:55 -0700 Subject: 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) --- lib/Vyatta/Qos/Match.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/Vyatta/Qos') 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; -- cgit v1.2.3