summaryrefslogtreecommitdiff
path: root/scripts/bgp/vyatta-bgp.pl
blob: d20ad8fa0a3b24bc3382ef9be64654d9861aad48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl
use lib "/opt/vyatta/share/perl5/";
use VyattaMisc;
use Getopt::Long;

GetOptions("check-peer-name=s"      => \$peername,
);

if (defined $peername) { check_peer_name($peername); }

exit 0;

sub check_peer_name() {
  my $neighbor = shift;

  $_ = $neighbor;
  if ((! isIpAddress("$neighbor")) && (/[\s\W]/g)) { 
    print "malformed neighbor address $neighbor\n";
    exit 1;
  }
  exit 0;
}