summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/bgp/vyatta-bgp.pl53
1 files changed, 13 insertions, 40 deletions
diff --git a/scripts/bgp/vyatta-bgp.pl b/scripts/bgp/vyatta-bgp.pl
index 22e8aa9e..383f085a 100755
--- a/scripts/bgp/vyatta-bgp.pl
+++ b/scripts/bgp/vyatta-bgp.pl
@@ -1070,11 +1070,13 @@ was_iBGP_peer($neighbor, $as) if ($wasiBGPpeer);
exit 0;
-# Make sure the peer IP is properly formatted
+# Make sure the peer IP isn't a local system IP
sub check_neighbor_ip {
my $neighbor = shift;
- exit 1 if ! is_ip_v4_or_v6($neighbor);
+ die "Can't set neighbor address to local system IP.\n"
+ if (is_local_address($neighbor));
+
exit 0;
}
@@ -1096,7 +1098,7 @@ sub check_peergroup_name {
}
# Make sure we aren't deleteing a peer-group that has
-# neighbors configured to us it
+# neighbors configured to it
sub check_for_peer_groups {
my $config = new Vyatta::Config;
my $pg = shift;
@@ -1374,46 +1376,17 @@ sub main {
# and that migrations to/from iBGP eBGP are valid
check_remote_as();
- # deletes with priority
- # delete everything in neighbor except for the important nodes
- my @skip_array = ('remote-as', 'route-map', 'filter-list', 'prefix-list', 'distribute-list', 'unsuppress-map');
+ ## deletes with priority
+ # delete everything in neighbor, ordered nodes last
+ my @ordered = ('remote-as', 'shutdown', 'route-map', 'prefix-list', 'filter-list', 'distribute-list', 'unsuppress-map');
# notice the extra space in the level string. keeps the parent from being deleted.
- $qconfig->deleteConfigTreeRecursive('protocols bgp var neighbor var ', @skip_array) || die "exiting $?\n";
- # now delete everything in neighbor except remote-as
- @skip_array = ('remote-as');
- $qconfig->deleteConfigTreeRecursive('protocols bgp var neighbor var ', @skip_array) || die "exiting $?\n";
- # now finish off neighbor
- $qconfig->deleteConfigTreeRecursive('protocols bgp var neighbor var') || die "exiting $?\n";
- # now delete everything in peer-group except remote-as
- @skip_array = ('remote-as');
- $qconfig->deleteConfigTreeRecursive('protocols bgp var peer-group var ', @skip_array) || die "exiting $?\n";
- # now finish off peer-group
- $qconfig->deleteConfigTreeRecursive('protocols bgp var peer-group var ') || die "exiting $?\n";
- # now delete everything else in the tree
+ $qconfig->deleteConfigTreeRecursive('protocols bgp var neighbor var ', undef, \@ordered) || die "exiting $?\n";
+ $qconfig->deleteConfigTreeRecursive('protocols bgp var peer-group var ', undef, \@ordered) || die "exiting $?\n";
$qconfig->deleteConfigTreeRecursive('protocols bgp') || die "exiting $?\n";
- # sets with priority
+ ## sets with priority
$qconfig->setConfigTreeRecursive('protocols bgp var parameters') || die "exiting $?\n";
- $qconfig->setConfigTree('protocols bgp var peer-group var remote-as') || die "exiting $?\n";
- $qconfig->setConfigTreeRecursive('protocols bgp var peer-group') || die "exiting $?\n";
- $qconfig->setConfigTree('protocols bgp var neighbor var remote-as') || die "exiting $?\n";
- $qconfig->setConfigTree('protocols bgp var neighbor var peer-group') || die "exiting $?\n";
- $qconfig->setConfigTree('protocols bgp var neighbor var shutdown') || die "exiting $?\n";
- $qconfig->setConfigTreeRecursive('protocols bgp var neighbor var route-map') || die "exiting $?\n";
- $qconfig->setConfigTreeRecursive('protocols bgp var neighbor var filter-list') || die "exiting $?\n";
- $qconfig->setConfigTreeRecursive('protocols bgp var neighbor var prefix-list') || die "exiting $?\n";
- $qconfig->setConfigTreeRecursive('protocols bgp var neighbor var distribute-list') || die "exiting $?\n";
- $qconfig->setConfigTreeRecursive('protocols bgp var neighbor var unsuppress-map') || die "exiting $?\n";
- $qconfig->setConfigTreeRecursive('protocols bgp var neighbor') || die "exiting $?\n";
+ $qconfig->setConfigTreeRecursive('protocols bgp var peer-group', undef, \@ordered) || die "exiting $?\n";
+ $qconfig->setConfigTreeRecursive('protocols bgp var neighbor var ', undef, \@ordered) || die "exiting $?\n";
$qconfig->setConfigTreeRecursive('protocols bgp') || die "exiting $?\n";
-
- # old priorities we are emulating with the above sets
- #705 protocols bgp var neighbhor shutdown
- #715 protocols bgp var neighbhor route-map
- #716 protocols bgp var neighbhor filter-list
- #717 protocols bgp var neighbhor prefix-list
- #718 protocols bgp var neighbhor distribute-list
- #719 protocols bgp var neighbhor unsuppress-map
- #720 protocols bgp var neighbhor
- #730 protocols bgp var
}