From mboxrd@z Thu Jan 1 00:00:00 1970 From: Federico Beffa Subject: Re: sockets availability during build Date: Fri, 23 Jan 2015 18:37:04 +0100 Message-ID: References: <87zj99x561.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEiAQ-0000Aq-AK for guix-devel@gnu.org; Fri, 23 Jan 2015 12:37:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEiAN-0002u8-8C for guix-devel@gnu.org; Fri, 23 Jan 2015 12:37:10 -0500 In-Reply-To: <87zj99x561.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: =?UTF-8?Q?Ludovic_Court=C3=A8s?= Cc: Guix-devel On Fri, Jan 23, 2015 at 9:38 AM, Ludovic Court=C3=A8s wrote: > I suspect the IP shown above is the result of: > > (getaddrinfo (gethostname)) > > or something like that. DNS lookups don=E2=80=99t work in the chroot, ex= cept > for =E2=80=9Clocalhost=E2=80=9D, so you may have to patch tests that rely= on this. > Sockets themselves should work fine. The error is produced by the system call "setsockopt". Here is the part of the strace log showing the error: ... write(4, "UpnpInit with HostIP=3D, DestPort=3D"..., 35) =3D 35 socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) =3D 6 ioctl(6, SIOCGIFCONF, {40, {{"lo", {AF_INET, inet_addr("127.0.0.1")}}}}) = =3D 0 ioctl(6, SIOCGIFFLAGS, {ifr_name=3D"lo", ifr_flags=3DIFF_UP|IFF_LOOPBACK|IFF_RUNNING}) =3D 0 ... bind(8, {sa_family=3DAF_INET, sin_port=3Dhtons(0), sin_addr=3Dinet_addr("127.0.0.1")}, 16) =3D 0 getsockname(8, {sa_family=3DAF_INET, sin_port=3Dhtons(42159), sin_addr=3Dinet_addr("127.0.0.1")}, [16]) =3D 0 write(4, "\n*******************************"..., 326) =3D 326 write(4, "sockfd =3D 8, .... port =3D 42159\n", 30) =3D 30 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) =3D 9 setsockopt(9, SOL_IP, IP_MULTICAST_TTL, "\4", 1) =3D 0 fcntl(9, F_GETFL) =3D 0x2 (flags O_RDWR) fcntl(9, F_SETFL, O_RDWR|O_NONBLOCK) =3D 0 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) =3D 10 setsockopt(10, SOL_SOCKET, SO_REUSEADDR, [1], 4) =3D 0 bind(10, {sa_family=3DAF_INET, sin_port=3Dhtons(1900), sin_addr=3Dinet_addr("0.0.0.0")}, 16) =3D 0 setsockopt(10, SOL_IP, IP_ADD_MEMBERSHIP, "\357\377\377\372\0\0\0\0", 8) =3D -1 ENODEV (No such device) fstat(3, {st_mode=3DS_IFREG|0644, st_size=3D0, ...}) =3D 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =3D 0x7f551880b000 write(3, "\n*******************************"..., 326) =3D 326 write(3, "Error in setsockopt() IP_ADD_MEM"..., 79) =3D 79 shutdown(10, SHUT_RDWR) =3D -1 ENOTCONN (Transport endpoint is not connected) ... Outside of the build environment, when the test passes, I see the same system call with the same parameters, but the call succeeds. The only difference seems to be in the first part which looks like this ... write(4, "UpnpInit with HostIP=3D, DestPort=3D"..., 35) =3D 35 socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) =3D 5 ioctl(5, SIOCGIFCONF, {80, {{"lo", {AF_INET, inet_addr("127.0.0.1")}}, {"eth0", {AF_INET, inet_addr("192.168.0.5")}}}}) =3D 0 ioctl(5, SIOCGIFFLAGS, {ifr_name=3D"lo", ifr_flags=3DIFF_UP|IFF_LOOPBACK|IFF_RUNNING}) =3D 0 ioctl(5, SIOCGIFFLAGS, {ifr_name=3D"eth0", ifr_flags=3DIFF_UP|IFF_BROADCAST|IFF_RUNNING|IFF_MULTICAST}) =3D 0 close(5) =3D 0 ... and shows the additional device "eth0". >From the above I understand that libupnp embedded server wants to setup multicast, but, as far as I know, this doesn't work with the "lo" interface and fails. I do not see a workaround. Anyone? Regards, Fede