diff options
author | Robert Bays <robert@vyatta.com> | 2011-12-19 16:51:27 -0800 |
---|---|---|
committer | Robert Bays <robert@vyatta.com> | 2011-12-19 16:51:27 -0800 |
commit | 52c9b8aae75c9aa97e6962addfb688282d037133 (patch) | |
tree | 57df3a37c96154d47f63baa96c5711d2ab3c68e5 /scripts | |
parent | f974f71f12d52dfe4896af01dce7a10187183b47 (diff) | |
download | vyatta-cfg-quagga-52c9b8aae75c9aa97e6962addfb688282d037133.tar.gz vyatta-cfg-quagga-52c9b8aae75c9aa97e6962addfb688282d037133.zip |
Bug 7665: BGP ridiculous load time
vyatta-bgp.pl: checkOverwritePeerGroupParameters()
pass in qconfig array rather than regenerate each time
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/bgp/vyatta-bgp.pl | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/scripts/bgp/vyatta-bgp.pl b/scripts/bgp/vyatta-bgp.pl index 0870fe05..79ea43bf 100755 --- a/scripts/bgp/vyatta-bgp.pl +++ b/scripts/bgp/vyatta-bgp.pl @@ -1069,8 +1069,6 @@ my %qcom = ( }, ); -my $qconfig = new Vyatta::Quagga::Config('protocols', \%qcom); - my ( $pg, $as, $neighbor ); my ( $main, $peername, $isneighbor, $checkpeergroups, $checksource, $isiBGPpeer, $wasiBGPpeer, $confedibgpasn, $listpeergroups); @@ -1242,7 +1240,7 @@ sub checkBannedPeerGroupParameters sub checkOverwritePeerGroupParameters { - my ($level, $protocol) = @_; + my ($qconfig_ref, $level, $protocol) = @_; my $ret = 0; unless ($protocol == 4 || $protocol == 6) { @@ -1263,7 +1261,7 @@ sub checkOverwritePeerGroupParameters foreach my $node (@globaloverwritelist) { if ($config->exists($node)) { - $qconfig->reInsertNode("protocols bgp $level $node"); + $$qconfig_ref->reInsertNode("protocols bgp $level $node"); $ret++; } } @@ -1273,7 +1271,7 @@ sub checkOverwritePeerGroupParameters } foreach my $node (@overwritelist) { if ($config->exists($node)) { - $qconfig->reInsertNode("protocols bgp $level $node"); + $$qconfig_ref->reInsertNode("protocols bgp $level $node"); $ret++; } } @@ -1284,6 +1282,7 @@ sub checkOverwritePeerGroupParameters # and that all permutations of parameters and BGP type are correct sub check_neighbor_parameters { + my $qconfig_ref = shift; my $config = new Vyatta::Config; $config->setLevel('protocols bgp'); @@ -1330,8 +1329,9 @@ sub check_neighbor_parameters # check if a peer-group overwrite parameter was changed and resubmit my @neighbors = $config->listNodes("$as neighbor"); foreach my $neighbor (@neighbors) { - if ($config->returnValue("$as neighbor $neighbor peer-group") eq "$peergroup") { - checkOverwritePeerGroupParameters("$as neighbor $neighbor", 4); + my $pg = $config->returnValue("$as neighbor $neighbor peer-group"); + if (defined $pg && ($pg eq "$peergroup")) { + checkOverwritePeerGroupParameters($qconfig_ref, "$as neighbor $neighbor", 4); } } } ## end foreach my $peergroup (@peergroups) @@ -1371,7 +1371,7 @@ sub check_neighbor_parameters checkBannedPeerGroupParameters("$as neighbor $neighbor", 4); } if ($config->isChanged("$as neighbor $neighbor peer-group")) { - checkOverwritePeerGroupParameters("$as neighbor $neighbor", 4); + checkOverwritePeerGroupParameters($qconfig_ref, "$as neighbor $neighbor", 4); } # check IPv6 peer-group @@ -1496,7 +1496,7 @@ sub check_source { sub main { # initialize the Quagga Config object with data from Vyatta config tree - # my $qconfig = new Vyatta::Quagga::Config('protocols', \%qcom); + my $qconfig = new Vyatta::Quagga::Config('protocols', \%qcom); # debug routines #$qconfig->setDebugLevel('3'); @@ -1504,7 +1504,7 @@ sub main # check that all changed neighbors have a proper remote-as or peer-group defined # and that migrations to/from iBGP eBGP are valid - check_neighbor_parameters(); + check_neighbor_parameters(\$qconfig); ## deletes with priority # delete everything in neighbor, ordered nodes last |