diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rwxr-xr-x | scripts/is_port_available.pl | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index 8e46a167..1ad95759 100644 --- a/Makefile.am +++ b/Makefile.am @@ -86,6 +86,7 @@ sbin_SCRIPTS += scripts/vyatta-dhcpv6-client.pl sbin_SCRIPTS += scripts/vyatta-update-grub.pl sbin_SCRIPTS += scripts/vyos-intfwatchd sbin_SCRIPTS += scripts/ec2-check.pl +sbin_SCRIPTS += scripts/is_port_available.pl sbin_PROGRAMS = src/valid_address sbin_PROGRAMS += src/local_ip diff --git a/scripts/is_port_available.pl b/scripts/is_port_available.pl new file mode 100755 index 00000000..52a5ad0f --- /dev/null +++ b/scripts/is_port_available.pl @@ -0,0 +1,15 @@ +#!/usr/bin/perl +# Check to see if the supplied IPv4 or IPv6 address is an existing local address + +use strict; +use lib "/opt/vyatta/share/perl5"; +use Vyatta::Misc; + +my $ip = $ARGV[0]; +my $port = $ARGV[1]; + +if(!defined($ip) || !defined($port) || !is_port_available($ip, $port)) { + exit 1; +} else { + exit 0; +}
\ No newline at end of file |