diff options
author | John Southworth <john.southworth@vyatta.com> | 2013-06-18 11:00:00 -0700 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2013-06-18 11:00:00 -0700 |
commit | d1b24f46e6427d1fd2b20b1722bf9d92ab124cf0 (patch) | |
tree | f141ed38b8609f3b01532cb2d10fd15e18f80f9e /lib/Vyatta/Qos/Match.pm | |
parent | e758688b38609af03b9fbc63e4472536314a8245 (diff) | |
download | vyatta-cfg-qos-d1b24f46e6427d1fd2b20b1722bf9d92ab124cf0.tar.gz vyatta-cfg-qos-d1b24f46e6427d1fd2b20b1722bf9d92ab124cf0.zip |
Bugfix 8469: ensure that matches have data under them
Diffstat (limited to 'lib/Vyatta/Qos/Match.pm')
-rw-r--r-- | lib/Vyatta/Qos/Match.pm | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/lib/Vyatta/Qos/Match.pm b/lib/Vyatta/Qos/Match.pm index 97e4aec..176748c 100644 --- a/lib/Vyatta/Qos/Match.pm +++ b/lib/Vyatta/Qos/Match.pm @@ -61,19 +61,27 @@ sub new { $fields{src} = $config->returnValue("ether source"); $fields{dst} = $config->returnValue("ether destination"); } else { - $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"); - - 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; + my $dsfield = $config->returnValue("$af dscp"); + my $ipprot = $config->returnValue("$af protocol"); + my $src = $config->returnValue("$af source address"); + my $dst = $config->returnValue("$af destination address"); + my $sport = $config->returnValue("$af source port"); + my $dport = $config->returnValue("$af destination port"); + + $fields{dsfield} = getDsfield($dsfield) if $dsfield; + $fields{protocol} = getProtocol($ipprot) if $ipprot; + $fields{src} = $src if $src; + $fields{dst} = $dst if $dst; + $fields{sport} = getPort( $sport, $ipprot ) if $sport; + $fields{dport} = getPort( $dport, $ipprot ) if $dport; } + # if the hash is empty then we didn't generate a match rule + # this usually means user left an uncompleted match in the config + my @keys = keys(%fields); + if ($#keys < 0) { + return undef; + } $self->{$af} = \%fields; die "Can not match on both $af and $lastaf protocol in same match\n" |