aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorGravatar John Hood <cgull@glup.org>2015-05-28 22:47:34 -0400
committerGravatar John Hood <cgull@glup.org>2015-05-28 22:49:46 -0400
commit9eeb2fbffa9f63e2a2f1121009d3e1bba7839ec6 (patch)
tree975f56743661a2fc2f7cebcb96a07451d3d479f3 /scripts
parente7903f0de2b93f729fbf6b524145e4d4309c95f3 (diff)
mosh.pl: Add a better error message for IPV6 & Socket::IP.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/mosh.pl19
1 files changed, 15 insertions, 4 deletions
diff --git a/scripts/mosh.pl b/scripts/mosh.pl
index 8c19138..41c31b0 100755
--- a/scripts/mosh.pl
+++ b/scripts/mosh.pl
@@ -172,12 +172,23 @@ if ( not defined $bind_ip or $bind_ip =~ m{^ssh$}i ) {
if ( defined $fake_proxy ) {
use Errno qw(EINTR);
- BEGIN {
- eval { require IO::Socket::IP; IO::Socket::IP->import('-register'); 1 } or
- eval { require IO::Socket::INET6 };
- }
+ my $have_ipv6 = eval {
+ require IO::Socket::IP;
+ IO::Socket::IP->import('-register');
+ 1;
+ } || eval {
+ require IO::Socket::INET6;
+ 1;
+ };
use POSIX qw(_exit);
+ # Report failure if IPv6 needed and not available.
+ if (lc($family) eq "inet6") {
+ if (!$have_ipv6) {
+ die "$0: IPv6 sockets not available in this Perl install\n";
+ }
+ }
+
my ( $host, $port ) = @ARGV;
# Resolve hostname and connect