From f7e73a6dc57755a58edda51c70be6bc0a21345cc Mon Sep 17 00:00:00 2001 From: Vincent Bernardoff Date: Tue, 15 Nov 2016 16:27:55 +0100 Subject: [PATCH] P2p: force IPv6 in discovery --- src/node/net/p2p.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/node/net/p2p.ml b/src/node/net/p2p.ml index 5223d0f78..071a98b17 100644 --- a/src/node/net/p2p.ml +++ b/src/node/net/p2p.ml @@ -638,7 +638,9 @@ module Make (P: PARAMS) = struct catch (fun () -> let ipaddr = Ipaddr_unix.of_inet_addr addr in - let socket = LU.(socket (match ipaddr with Ipaddr.V4 _ -> PF_INET | V6 _ -> PF_INET6) SOCK_STREAM 0) in + let ipaddr = Ipaddr.(match ipaddr with V4 addr -> V6 (v6_of_v4 addr) | _ -> ipaddr) in + let addr = Ipaddr_unix.to_inet_addr ipaddr in + let socket = LU.(socket PF_INET6 SOCK_STREAM 0) in LU.connect socket LU.(ADDR_INET (addr, port)) >>= fun () -> callback ipaddr port socket >>= fun () -> return ())