diff options
author | Robert Bays <robert@vyatta.com> | 2011-09-29 11:37:02 -0700 |
---|---|---|
committer | Robert Bays <robert@vyatta.com> | 2011-09-29 11:37:02 -0700 |
commit | 33d8cca996a4f8dd1a5d918c57cc4c82696694bb (patch) | |
tree | 886988f41b43d703e0708254c98bbe5bec66d76c | |
parent | e98efcd23704d75b64f6a064d5aed5f62318a926 (diff) | |
download | vyatta-cfg-quagga-33d8cca996a4f8dd1a5d918c57cc4c82696694bb.tar.gz vyatta-cfg-quagga-33d8cca996a4f8dd1a5d918c57cc4c82696694bb.zip |
bgpd: Bug 7530 - Peer-group commit fails with error when no remote-as is defined
-rwxr-xr-x | scripts/bgp/vyatta-bgp.pl | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/scripts/bgp/vyatta-bgp.pl b/scripts/bgp/vyatta-bgp.pl index bc1bab0b..4f4ac40e 100755 --- a/scripts/bgp/vyatta-bgp.pl +++ b/scripts/bgp/vyatta-bgp.pl @@ -1325,21 +1325,22 @@ sub check_neighbor_parameters foreach my $neighbor (@neighbors) { # check that remote-as exists if ($config->isChanged("$as neighbor $neighbor remote-as") || - $config->isDeleted("$as neighbor $neighbor remote-as")) { - # remote-as checks: Make sure the neighbor has a remote-as defined locally or in the peer-group - my ($remoteas, $peergroup, $peergroupas); - $remoteas = $config->returnValue("$as neighbor $neighbor remote-as"); - if ($config->exists("$as neighbor $neighbor peer-group")) { - $peergroup = $config->returnValue("$as neighbor $neighbor peer-group"); + $config->isDeleted("$as neighbor $neighbor remote-as") || + ! $config->exists("$as neighbor $neighbor remote-as")) { + # remote-as checks: Make sure the neighbor has a remote-as defined locally or in the peer-group + my ($remoteas, $peergroup, $peergroupas); + $remoteas = $config->returnValue("$as neighbor $neighbor remote-as"); + if ($config->exists("$as neighbor $neighbor peer-group")) { + $peergroup = $config->returnValue("$as neighbor $neighbor peer-group"); if ($config->exists("$as peer-group $peergroup remote-as")) { - $peergroupas = $config->returnValue("$as peer-group $peergroup remote-as"); + $peergroupas = $config->returnValue("$as peer-group $peergroup remote-as"); } - } + } - die "[ protocols bgp $as neighbor $neighbor ]\n must set remote-as or peer-group with remote-as defined\n" - unless ($remoteas || $peergroupas); + die "[ protocols bgp $as neighbor $neighbor ]\n must set remote-as or peer-group with remote-as defined\n" + unless ($remoteas || $peergroupas); - die "[ protocols bgp $as neighbor $neighbor ]\n remote-as should not be defined in both neighbor and peer-group\n" + die "[ protocols bgp $as neighbor $neighbor ]\n remote-as should not be defined in both neighbor and peer-group\n" if ($remoteas && $peergroupas); } ## end remote-as checks @@ -1347,24 +1348,24 @@ sub check_neighbor_parameters my $error = bgp_type_change($neighbor, $as, "neighbor"); if ($error) { die "[ protocols bgp $as neighbor $neighbor ]\n $error\n"; } - # If the peer-group has changed since the last commit, update overwritable nodes - # We do this because Quagga removes nodes silently while vyatta-cfg does not. - # check IPv4 peer-group - if ($config->exists("$as neighbor $neighbor peer-group")) { - checkBannedPeerGroupParameters("$as neighbor $neighbor", 4); - } - if ($config->isChanged("$as neighbor $neighbor peer-group") || - $config->isDeleted("$as neighbor $neighbor peer-group")) { - checkOverwritePeerGroupParameters("$as neighbor $neighbor", 4); - } + # If the peer-group has changed since the last commit, update overwritable nodes + # We do this because Quagga removes nodes silently while vyatta-cfg does not. + # check IPv4 peer-group + if ($config->exists("$as neighbor $neighbor peer-group")) { + checkBannedPeerGroupParameters("$as neighbor $neighbor", 4); + } + if ($config->isChanged("$as neighbor $neighbor peer-group") || + $config->isDeleted("$as neighbor $neighbor peer-group")) { + checkOverwritePeerGroupParameters("$as neighbor $neighbor", 4); + } - # check IPv6 peer-group - if ($config->exists("$as neighbor $neighbor address-family ipv6-unicast peer-group")) { - checkBannedPeerGroupParameters("$as neighbor $neighbor", 6); - } - if ($config->isChanged("$as neighbor $neighbor address-family ipv6-unicast peer-group") || - $config->isDeleted("$as neighbor $neighbor address-family ipv6-unicast peer-group")) { - checkOverwritePeerGroupParameters("$as neighbor $neighbor", 6); + # check IPv6 peer-group + if ($config->exists("$as neighbor $neighbor address-family ipv6-unicast peer-group")) { + checkBannedPeerGroupParameters("$as neighbor $neighbor", 6); + } + if ($config->isChanged("$as neighbor $neighbor address-family ipv6-unicast peer-group") || + $config->isDeleted("$as neighbor $neighbor address-family ipv6-unicast peer-group")) { + checkOverwritePeerGroupParameters("$as neighbor $neighbor", 6); } } ## end foreach my $neighbor (@neighbors) } ## end foreach my $as (@asns) @@ -1437,6 +1438,9 @@ sub iBGP_peer { my $peergroup = $returnValue->("neighbor $neighbor peer-group"); $neighbor_as = $returnValue->("peer-group $peergroup remote-as"); } + else { + return -1; + } } else { return -1; |