diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2011-01-01 16:14:48 -0800 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2011-01-01 16:14:48 -0800 |
commit | 47914551530e3ef2232ce18959d08a6018f9a580 (patch) | |
tree | e0e8d6f9fbbc32bd68694510f5b381dfea8c9814 /scripts/bgp/vyatta-bgp.pl | |
parent | fa8b079a5e0b370bee12ba9bde63eef925ef4043 (diff) | |
parent | e09955a8cfc8a2d8f10f0aa3c4f1bdf8e33bdb16 (diff) | |
download | vyatta-cfg-quagga-47914551530e3ef2232ce18959d08a6018f9a580.tar.gz vyatta-cfg-quagga-47914551530e3ef2232ce18959d08a6018f9a580.zip |
Merge branch 'mendocino' of http://git.vyatta.com/vyatta-cfg-quagga into mendocino
Diffstat (limited to 'scripts/bgp/vyatta-bgp.pl')
-rwxr-xr-x | scripts/bgp/vyatta-bgp.pl | 53 |
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 } |