From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 27 10:40:56 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C0A3416A420; Fri, 27 Jan 2006 10:40:56 +0000 (GMT) (envelope-from fli+freebsd-hackers@shapeshifter.se) Received: from mx1.h3q.net (manticore.shapeshifter.se [212.37.5.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 24E5143D48; Fri, 27 Jan 2006 10:40:53 +0000 (GMT) (envelope-from fli+freebsd-hackers@shapeshifter.se) Received: from localhost (localhost [127.0.0.1]) by mx1.h3q.net (Postfix) with ESMTP id CF3A31A84C; Fri, 27 Jan 2006 11:40:51 +0100 (CET) Received: from mx1.h3q.net ([127.0.0.1]) by localhost (mx1.h3q.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14193-08; Fri, 27 Jan 2006 11:40:50 +0100 (CET) Received: from [192.168.0.83] (81-234-243-91-o926.tbon.telia.com [81.234.243.91]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.h3q.net (Postfix) with ESMTP id 32D601A6A8; Fri, 27 Jan 2006 11:40:50 +0100 (CET) Message-ID: <43D9F8AD.2020502@shapeshifter.se> Date: Fri, 27 Jan 2006 11:40:45 +0100 From: Fredrik Lindberg User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050928) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kurt Miller References: <200601262340.46999.lists@intricatesoftware.com> In-Reply-To: <200601262340.46999.lists@intricatesoftware.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at h3q.net Cc: Daniel Eischen , freebsd-hackers@freebsd.org Subject: Re: read hang on datagram socket X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2006 10:40:56 -0000 Kurt Miller wrote: > On Thursday 26 January 2006 7:26 pm, Daniel Eischen wrote: > >>On Thu, 26 Jan 2006, Kurt Miller wrote: >> >> >>>On Thursday 26 January 2006 6:56 pm, Daniel Eischen wrote: >>> >>>>On Thu, 26 Jan 2006, Kurt Miller wrote: >>>> >>>> >>>>>I'm working on 1.5 jdk certification on 5.4 and 6.0. One of the jck >>>>>tests hangs on 5.4 but works ok on 6.0. I've reduced the problem >>>>>down to the following C program that hangs on 5.4 but works fine >>>>>(finishes) on 6.0 and 4.11. >>>>> >>>>>I could use some assistance with finding a work-around to the >>>>>problem or an explanation as to why the program hangs on 5.4. >>>> >>>>It exit'd in the last connect() in Solaris 9. I modified it >>>>to work -- see below. >>> >>>Thanks, that was my bug (the jdk did it right). It Sill hangs on 5.4 >>>though. >> >>The modified version does not hang on 5.2. Do you have multiple >>interfaces on your 5.4 box? > > > No, the 5.4 box is virtually identical to the 6.0 box. I set them both > up at the same time from initial installs for the project. > > truk@freebsd5-4$ ifconfig > lnc0: flags=108843 mtu 1500 > inet6 fe80::250:56ff:fe40:451a%lnc0 prefixlen 64 scopeid 0x1 > inet 172.16.1.36 netmask 0xffffff00 broadcast 172.16.1.255 > ether 00:50:56:40:45:1a > lo0: flags=8049 mtu 16384 > inet 127.0.0.1 netmask 0xff000000 > inet6 ::1 prefixlen 128 > inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 > > truk@freebsd6-0$ ifconfig > lnc0: flags=108843 mtu 1500 > inet6 fe80::250:56ff:fe40:4533%lnc0 prefixlen 64 scopeid 0x1 > inet 172.16.1.37 netmask 0xffffff00 broadcast 172.16.1.255 > ether 00:50:56:40:45:33 > lo0: flags=8049 mtu 16384 > inet6 ::1 prefixlen 128 > inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 > inet 127.0.0.1 netmask 0xff000000 > > >>What happens when you try using non-zero IP addresses and ports? >> > > > Setting the ports doesn't effect the problem, however setting the > addresses does. It really seems like binding to INADDR_ANY only binds > to loopback address 127.0.0.1 and not all the interfaces. > > If sock1 is bound to the hostAddress and sock2 connects to sock1 at > the hostAddress it works ok. If sock1 is bound to INADDR_ANY and sock2 > connects to sock1 using INADDR_ANY it works. but any mixture of of > using INADDR_ANY with the hostAddress fails. > > Unfortunately, I don't have control over the addresses, the java > programs do. This particular jck test binds the first socket with > INADDR_ANY (InetAddress.getByName("0.0.0.0")) and connects the second > socket to the first using the hostAddress (InetAddress.getLocalHost()). > > netstat output when stopping the program at the sendto call on 5.4 > looks like this: > udp4 0 0 localhost.55513 172.16.1.36.52099 > > on 6.0: > udp4 0 0 172.16.1.37.53952 172.16.1.37.62241 > > Doesn't the above output indicate a problem with how datagram > sockets are bound to INADDR_ANY? > > Perhaps its related to my configuration. Can anyone else with a > 5.4-release system try the program to see if it works for them? > It works on a 5.4-RELEASE-p5 system. fli> ./test no hang fli> ifconfig em0: flags=8843 mtu 1500 options=b inet 212.XX.XX.XX netmask 0xfffffff8 broadcast 212.XX.XX.XX inet6 fe80::240:d0ff:fe43:b964%em0 prefixlen 64 scopeid 0x1 ether 00:40:d0:43:b9:64 media: Ethernet autoselect (100baseTX ) status: active em1: flags=8802 mtu 1500 options=b ether 00:40:d0:43:b9:65 media: Ethernet autoselect status: no carrier lo0: flags=8049 mtu 16384 inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 Stopping it before sendto() gives udp4 0 0 212.XX.XX.XX.54074 212.XX.XX.XX.56604 Fredrik Lindberg