summaryrefslogtreecommitdiff
path: root/scripts/bgp
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-31 07:37:19 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-31 07:37:19 -0700
commit3720b90870a67e3920f6a03b6b8d68c84988a2c5 (patch)
treec56f452234081157887d72a6b05b00052e79c378 /scripts/bgp
parent5312e84665a2a3596869e261ce9f6462f88505b2 (diff)
downloadvyatta-cfg-quagga-3720b90870a67e3920f6a03b6b8d68c84988a2c5.tar.gz
vyatta-cfg-quagga-3720b90870a67e3920f6a03b6b8d68c84988a2c5.zip
Yet another logic error in vyatta-bgp
Check for remote-as/peer-group was backwards.
Diffstat (limited to 'scripts/bgp')
-rwxr-xr-xscripts/bgp/vyatta-bgp.pl25
1 files changed, 10 insertions, 15 deletions
diff --git a/scripts/bgp/vyatta-bgp.pl b/scripts/bgp/vyatta-bgp.pl
index f6ae9e72..4bc27c53 100755
--- a/scripts/bgp/vyatta-bgp.pl
+++ b/scripts/bgp/vyatta-bgp.pl
@@ -18,10 +18,10 @@ GetOptions(
"check-if-peer-group" => \$checkifpeergroup,
);
-check_peer_name($peername) if ($peername);
-check_for_peer_groups( $pg, $as ) if ($checkpeergroups);
-check_as( ( $pg ? $pg : -1 ), $neighbor, $as ) if ($checkas);
-check_if_peer_group($pg) if ($checkifpeergroup);
+check_peer_name($peername) if ($peername);
+check_for_peer_groups( $pg, $as ) if ($checkpeergroups);
+check_as( $pg, $neighbor, $as ) if ($checkas);
+check_if_peer_group($pg) if ($checkifpeergroup);
exit 0;
@@ -85,30 +85,25 @@ sub check_for_peer_groups {
# make sure nodes are either in a peer group of have
# a remote AS assigned to them.
sub check_as {
- my $pg = shift;
- my $neighbor = shift;
+ my ($pg,$neighbor, $as) = @_;
+
die "Neighbor not defined" unless $neighbor;
- my $as = shift;
+ die "neighbor must be address" unless is_ip_v4_or_v6($neighbor);
die "AS not defined\n" unless $as;
- my $config = new Vyatta::Config;
- my $pgtest = $neighbor;
# if this is peer-group then short circuit this
- return unless is_ip_v4_or_v6($pg);
-
+ my $config = new Vyatta::Config;
$config->setLevel("protocols bgp $as neighbor $neighbor");
my $remoteas = $config->returnValue("remote-as");
-
return if defined $remoteas;
- return if ( $pg > 0 );
+ return if $pg;
my $peergroup = $config->returnValue("peer-group");
- my $peergroupas = $config->returnValue(" .. $peergroup remote-as");
-
die "protocols bgp $as neighbor $neighbor: must define a remote-as or peer-group\n"
unless $peergroup;
+ my $peergroupas = $config->returnValue(" .. $peergroup remote-as");
die "protocols bgp $as neighbor $neighbor: must define a remote-as in neighbor or peer-group $peergroup\n"
unless $peergroupas;
}