diff options
author | Ruben Herold <ruben@puettmann.net> | 2019-05-29 14:31:37 +0200 |
---|---|---|
committer | Ruben Herold <ruben@puettmann.net> | 2019-05-29 16:07:59 +0200 |
commit | 7eecaeecd52e222b3883c9212ecd0b5242648363 (patch) | |
tree | e1bbf4065b685f0eb736af9462150e7589656f32 /scripts/bgp | |
parent | 50cf64c80da6d964bffaaa27149a55b25a4c09d0 (diff) | |
download | vyatta-cfg-quagga-7eecaeecd52e222b3883c9212ecd0b5242648363.tar.gz vyatta-cfg-quagga-7eecaeecd52e222b3883c9212ecd0b5242648363.zip |
T1390: Add support for remote-as external and internal
Diffstat (limited to 'scripts/bgp')
-rwxr-xr-x | scripts/bgp/vyatta-bgp.pl | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/scripts/bgp/vyatta-bgp.pl b/scripts/bgp/vyatta-bgp.pl index 25dd4328..d572c0ba 100755 --- a/scripts/bgp/vyatta-bgp.pl +++ b/scripts/bgp/vyatta-bgp.pl @@ -1126,8 +1126,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, @@ -1142,6 +1142,7 @@ GetOptions( "was-iBGP" => \$wasiBGPpeer, "confed-iBGP-ASN-check=s" => \$confedibgpasn, "list-peer-groups" => \$listpeergroups, + "check-remote-as=s" => \$checkremoteas, "main" => \$main, ); @@ -1155,6 +1156,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; @@ -1195,6 +1197,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 { |