diff options
author | Robert Bays <robert@vyatta.com> | 2010-07-09 16:15:38 -0700 |
---|---|---|
committer | Robert Bays <robert@vyatta.com> | 2010-07-09 16:15:38 -0700 |
commit | ebe0ccaee6c0aa9ac7ea295cf1f42cbff1917c3b (patch) | |
tree | ab378cb012587bb761095df427c9524e07d86c48 /scripts | |
parent | 76ab11b901ba09c3f715ad8ef89a3ff8222d7a03 (diff) | |
download | vyatta-cfg-quagga-ebe0ccaee6c0aa9ac7ea295cf1f42cbff1917c3b.tar.gz vyatta-cfg-quagga-ebe0ccaee6c0aa9ac7ea295cf1f42cbff1917c3b.zip |
more robust fix for local-as
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/bgp/vyatta-bgp.pl | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/scripts/bgp/vyatta-bgp.pl b/scripts/bgp/vyatta-bgp.pl index 4c23cd28..2d49eef8 100755 --- a/scripts/bgp/vyatta-bgp.pl +++ b/scripts/bgp/vyatta-bgp.pl @@ -1092,7 +1092,7 @@ my %qcom = ( ); my ( $pg, $as, $neighbor ); -my ( $main, $peername, $isneighbor, $checkpeergroups, $checksource ); +my ( $main, $peername, $isneighbor, $checkpeergroups, $checksource, $checklocalas ); GetOptions( "peergroup=s" => \$pg, @@ -1102,6 +1102,7 @@ GetOptions( "check-neighbor-ip" => \$isneighbor, "check-peer-groups" => \$checkpeergroups, "check-source=s" => \$checksource, + "check-local-as" => \$checklocalas, "main" => \$main, ); @@ -1110,6 +1111,7 @@ check_peergroup_name($peername) if ($peername); check_neighbor_ip($neighbor) if ($isneighbor); check_for_peer_groups( $pg, $as ) if ($checkpeergroups); check_source($checksource) if ($checksource); +check_local_as($neighbor, $as) if ($checklocalas); exit 0; @@ -1244,6 +1246,25 @@ sub check_remote_as { } +# Verify that is local-as is used, the peer isn't in a confedration +sub check_local_as { + my ($neighbor, $as) = @_; + my $config = new Vyatta::Config; + + $config->setLevel("protocols bgp $as"); + if ($config->exists('parameters confederation peers')) { + my @peers = $config->returnValues('parameters confederation peers'); + my $remoteas = $config->returnValue("neighbor $neighbor remote-as"); + foreach my $peeras (@peers) { + if ("$peeras" eq "$remoteas") { + print "local-as can't be set for neighbors in a peer group\n"; + return 1; + } + } + } + return 0; +} + # check that value is either an IPV4 address on system or an interface sub check_source { my $src = shift; |