From e7903f0de2b93f729fbf6b524145e4d4309c95f3 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 29 Sep 2014 16:28:50 -0400 Subject: [PATCH] scripts/mosh: Allow IO::Socket::INET6 as an alternative to IO::Socket::IP Some systems have IO::Socket::INET6 preinstalled, so we might as well accept either. Signed-off-by: Anders Kaseorg --- man/mosh.1 | 3 ++- scripts/mosh.pl | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/man/mosh.1 b/man/mosh.1 index 1e6a6a2..8838c61 100644 --- a/man/mosh.1 +++ b/man/mosh.1 @@ -123,7 +123,8 @@ Synonym for \-\-predict=never .TP .B --family=\fIFAMILY\fP Force the use of a particular address family, which defaults to `inet' -(IPv4), and can also be `inet6' (IPv6; requires IO::Socket::IP). +(IPv4), and can also be `inet6' (IPv6; requires IO::Socket::IP or +IO::Socket::INET6). .TP .B -4 diff --git a/scripts/mosh.pl b/scripts/mosh.pl index 6a3aea6..8c19138 100755 --- a/scripts/mosh.pl +++ b/scripts/mosh.pl @@ -172,7 +172,10 @@ 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'); }; } + BEGIN { + eval { require IO::Socket::IP; IO::Socket::IP->import('-register'); 1 } or + eval { require IO::Socket::INET6 }; + } use POSIX qw(_exit); my ( $host, $port ) = @ARGV;