diff options
author | Alex Harpin <development@landsofshadow.co.uk> | 2015-10-17 18:06:01 +0100 |
---|---|---|
committer | Alex Harpin <development@landsofshadow.co.uk> | 2015-10-17 19:05:43 +0100 |
commit | 7ab0b09d138d17571523dba4177e70b98c9001d0 (patch) | |
tree | 3b78cce2ff4863b716dd70b215357f263d13cb28 /scripts | |
parent | 3dd156041ecb1317222ac266199872f8b19f6dfa (diff) | |
download | vyatta-cfg-system-7ab0b09d138d17571523dba4177e70b98c9001d0.tar.gz vyatta-cfg-system-7ab0b09d138d17571523dba4177e70b98c9001d0.zip |
vyatta-cfg-system: add scripts/is_port_available.pl for port checking
Add scripts/is_available.pl to enable checking for available ports
during configuration, in connection with Bug #43. The scripts checks
to see if the port is currently in use by attempting to bind to it
on INADDR_ANY.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/is_port_available.pl | 15 |
1 files changed, 15 insertions, 0 deletions
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 |