From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 8DF48BC0A for ; Sat, 5 May 2007 17:16:12 +0200 (CEST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l45FGCIR009015 for ; Sat, 5 May 2007 17:16:12 +0200 Received: by ug-out-1314.google.com with SMTP id k3so720938ugf for ; Sat, 05 May 2007 08:16:12 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=okb40JUxCXLpSeumpVm0E0wkqKIC3xpetifWGKNrvFHACCcKYPhYrkm2x78DjfcZKEQw/SEl0Z9yGqG6LKAZQMnOg+NzRV0+TMW5tfncf0/yXj/+dIHL4JfcAP/90lbdsZFVJ30zTCSeKuVZaqe1q2jA8GTFz92y6w2ZeDrMekM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=oanEugRHgJ2ZsBXSDSuSUudTDMx+1wbaLm6XoPadvyuj3077XGAO8mFTArrHnROMT2mNsV8oOsVCApfKzuE55t0O1vlUgGZzbJapNQEqWu8U0hPPlMtkdMoqqdg2hb3jGlB8/wOMPhS5c28MG40H/EE4+xjLMvl3WDvZMBgfBxk= Received: by 10.67.22.14 with SMTP id z14mr3572031ugi.1178378171960; Sat, 05 May 2007 08:16:11 -0700 (PDT) Received: from ?192.168.1.33? ( [83.34.3.221]) by mx.google.com with ESMTP id b30sm4109077ika.2007.05.05.08.16.10; Sat, 05 May 2007 08:16:11 -0700 (PDT) In-Reply-To: References: <71B2C4B5-3ECB-450F-B015-3C5EAB90855F@gmail.com> <75F71DDF-CACC-4AD9-A3DA-E0049FC9FB2F@gmail.com> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <6AC4F0FE-E2D1-4EDD-87A5-2FA3CBB0FBBE@gmail.com> Cc: Gerd Stolpmann Content-Transfer-Encoding: 7bit From: Joel Reymont Subject: Solved! (was Re: Mac OSX getsocketpair/getsockname and IPv6) Date: Sat, 5 May 2007 16:16:07 +0100 To: OCaml List X-Mailer: Apple Mail (2.752.3) X-j-chkmail-Score: MSGID : 463C9FBC.000 on discorde : j-chkmail score : XXX : 5/20 1 0.000 -> 3 X-Miltered: at discorde with ID 463C9FBC.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; osx:01 getsockname:01 alloc:01 sockaddr:01 usr:01 alloc:01 sockaddr:01 ocamlnet:01 ocaml:01 stack:01 ocamlnet:01 ocaml:01 otherlibs:01 socketaddr:01 adr:01 The culprit is in alloc_sockaddr [1]. adr->s_gen.sa_family is 0 which stands for AF_UNSPEC in my /usr/ include/sys/socket.h. alloc_sockaddr does not handle this family type and throws EAFNOSUPPORT. I'm inclined to think that ocamlnet should be fixed and not the OCaml library, although it would be helpful if an error different from EAFNOSUPPORT was used. I would have been most helpful to have a stack trace on exception as this would have allowed me to narrow down the source of the problem in no time rather than going spelunking through ocamlnet and OCaml networking libraries. Thanks, Joel [1] otherlibs/unix/socketaddr.c value alloc_sockaddr(union sock_addr_union * adr /*in*/, socklen_param_type adr_len, int close_on_error) { value res; switch(adr->s_gen.sa_family) { #ifndef _WIN32 case AF_UNIX: { value n = copy_string(adr->s_unix.sun_path); Begin_root (n); res = alloc_small(1, 0); Field(res,0) = n; End_roots(); break; } #endif case AF_INET: { value a = alloc_inet_addr(&adr->s_inet.sin_addr); Begin_root (a); res = alloc_small(2, 1); Field(res,0) = a; Field(res,1) = Val_int(ntohs(adr->s_inet.sin_port)); End_roots(); break; } #ifdef HAS_IPV6 case AF_INET6: { value a = alloc_inet6_addr(&adr->s_inet6.sin6_addr); Begin_root (a); res = alloc_small(2, 1); Field(res,0) = a; Field(res,1) = Val_int(ntohs(adr->s_inet6.sin6_port)); End_roots(); break; } #endif default: if (close_on_error != -1) close (close_on_error); unix_error(EAFNOSUPPORT, "", Nothing); } return res; } -- http://wagerlabs.com/