From 3c3356e20e53e22e40920d4edee0acb7f7a6e8bc Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Fri, 3 Feb 2012 15:19:03 +0100 Subject: Better handling of IPv6 --- lib/ssh/src/ssh.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/ssh') diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl index e7cedfba3e..29294b836f 100644 --- a/lib/ssh/src/ssh.erl +++ b/lib/ssh/src/ssh.erl @@ -345,7 +345,13 @@ handle_options([Opt | Rest], SockOpts, Opts) -> inetopt(true) -> inet; inetopt(false) -> - inet6. + case gen_tcp:listen(0, [inet6, {ip, loopback}]) of + {ok, Dummyport} -> + gen_tcp:close(Dummyport), + inet6; + _ -> + inet + end. %%% %% Deprecated -- cgit v1.2.3