diff options
author | Robert Bays <robert@vyatta.com> | 2010-07-12 17:22:35 -0700 |
---|---|---|
committer | Robert Bays <robert@vyatta.com> | 2010-07-12 17:22:35 -0700 |
commit | 5bd5800687492d8fe4811c7d54b7a987ccf2e724 (patch) | |
tree | d9f77b96f06bd26a128d7b8d8c2f6fe69071ca30 /lib/Vyatta | |
parent | 9ef28d16e6aaa5828d5c6946fc23eb691e321396 (diff) | |
download | vyatta-cfg-quagga-5bd5800687492d8fe4811c7d54b7a987ccf2e724.tar.gz vyatta-cfg-quagga-5bd5800687492d8fe4811c7d54b7a987ccf2e724.zip |
fix for bug 5760: BGP configuration script does not handle "multi:" node values correctly
Diffstat (limited to 'lib/Vyatta')
-rw-r--r-- | lib/Vyatta/Quagga/Config.pm | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/lib/Vyatta/Quagga/Config.pm b/lib/Vyatta/Quagga/Config.pm index 4eee2e8f..4f3a9d36 100644 --- a/lib/Vyatta/Quagga/Config.pm +++ b/lib/Vyatta/Quagga/Config.pm @@ -354,19 +354,44 @@ sub _qtree { # if I found a Quagga command template, then replace any vars if ($qcommand) { - # get the apropos config value so we can use it in the Quagga command template - my $val = undef; - if ($action eq 'set') { $val = $config->returnValue($node); } - else { $val = $config->returnOrigValue($node); } + # get the apropos config value so we can use it in the Quagga command template + my @vals = undef; + + # This is either a set or delete on a single or multi: node + if ($action eq 'set') { + my $tmplhash = $config->parseTmplAll(join ' ', "$level $node"); + if ($tmplhash->{'multi'}) { + if ($_DEBUG > 2) { print "DEBUG: multi\n"; } + @vals = $config->returnValues($node); + } + else { + if ($_DEBUG > 2) { print "DEBUG: not a multi\n"; } + $vals[0] = $config->returnValue($node); + } + } + else { + my $tmplhash = $config->parseTmplAll(join ' ', "$level $node"); + if ($tmplhash->{'multi'}) { + if ($_DEBUG > 2) { print "DEBUG: multi\n"; } + @vals = $config->returnOrigValues($node); + } + else { + if ($_DEBUG > 2) { print "DEBUG: not a multi\n"; } + $vals[0] = $config->returnOrigValue($node); + } + } # is this a leaf node? - if ($val) { - my $var = _qVarReplace("$level $node $val", $qcom->{$qcommand}->{$action}); - push @{$vtysh->{"$qcommand"}}, $var; - if ($_DEBUG) { - print "DEBUG: _qtree leaf node command: set $level $action $node $val \n\t\t\t\t\t$var\n"; + if (defined $vals[0]) { + foreach my $val (@vals) { + my $var = _qVarReplace("$level $node $val", $qcom->{$qcommand}->{$action}); + push @{$vtysh->{"$qcommand"}}, $var; + if ($_DEBUG) { + print "DEBUG: _qtree leaf node command: set $level $action $node $val \n\t\t\t\t\t$var\n"; + } } } + else { my $var = _qVarReplace("$level $node", $qcom->{$qcommand}->{$action}); push @{$vtysh->{"$qcommand"}}, $var; |