summaryrefslogtreecommitdiff
path: root/scripts/bgp/vyatta-bgp.pl
diff options
context:
space:
mode:
authorRuben Herold <ruben@puettmann.net>2019-05-29 14:31:37 +0200
committerChristian Poessinger <christian@poessinger.com>2019-06-17 22:17:06 +0200
commit707e72e9d449beba232599f7af5ac72c0ac8ce16 (patch)
tree10ec691331252b25a29af71da246003868130eeb /scripts/bgp/vyatta-bgp.pl
parentfc9b264b51dc5edfab76091fae1218b8cb2d3f55 (diff)
downloadvyatta-cfg-quagga-707e72e9d449beba232599f7af5ac72c0ac8ce16.tar.gz
vyatta-cfg-quagga-707e72e9d449beba232599f7af5ac72c0ac8ce16.zip
T1390: Add support for remote-as external and internal
(cherry picked from commit 7eecaeecd52e222b3883c9212ecd0b5242648363)
Diffstat (limited to 'scripts/bgp/vyatta-bgp.pl')
-rwxr-xr-xscripts/bgp/vyatta-bgp.pl22
1 files changed, 20 insertions, 2 deletions
diff --git a/scripts/bgp/vyatta-bgp.pl b/scripts/bgp/vyatta-bgp.pl
index 799240af..abf3ed4b 100755
--- a/scripts/bgp/vyatta-bgp.pl
+++ b/scripts/bgp/vyatta-bgp.pl
@@ -1122,8 +1122,8 @@ if ( ! -e "/usr/sbin/zebra" ) {
}
my ( $pg, $as, $neighbor );
-my ( $main, $peername, $isneighbor, $checkpeergroups, $checkpeergroups6, $checksource,
- $isiBGPpeer, $wasiBGPpeer, $confedibgpasn, $listpeergroups);
+my ( $main, $peername, $isneighbor, $checkpeergroups, $checkpeergroups6, $checksource,
+ $isiBGPpeer, $wasiBGPpeer, $confedibgpasn, $listpeergroups, $checkremoteas);
GetOptions(
"peergroup=s" => \$pg,
@@ -1138,6 +1138,7 @@ GetOptions(
"was-iBGP" => \$wasiBGPpeer,
"confed-iBGP-ASN-check=s" => \$confedibgpasn,
"list-peer-groups" => \$listpeergroups,
+ "check-remote-as=s" => \$checkremoteas,
"main" => \$main,
);
@@ -1151,6 +1152,7 @@ confed_iBGP_ASN($as, $confedibgpasn) if ($confedibgpasn);
is_iBGP_peer($neighbor, $as) if ($isiBGPpeer);
was_iBGP_peer($neighbor, $as) if ($wasiBGPpeer);
list_peer_groups($as) if ($listpeergroups);
+check_remote_as($checkremoteas) if ($checkremoteas);
exit 0;
@@ -1191,6 +1193,22 @@ sub check_peergroup_name {
}
}
+sub check_remote_as {
+ my $remote_as = shift;
+
+ if ($remote_as =~ /^(\d+)$/) {
+ if ( $remote_as >= 1 && $remote_as <= 4294967294) {
+ exit 0;
+ }
+ die "remote-as must be between 1 and 4294967294 or external or internal";
+ }
+
+ if ( $remote_as eq "external" || $remote_as eq "internal") {
+ exit 0;
+ }
+ die "remote-as must be between 1 and 4294967294 or external or internal";
+}
+
# Make sure we aren't deleteing a peer-group that has
# neighbors configured to it
sub check_for_peer_groups6 {