From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O9Ku5-0002A8-7q for qemu-devel@nongnu.org; Tue, 04 May 2010 12:23:25 -0400 Received: from [140.186.70.92] (port=41199 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9Ku3-00029g-Su for qemu-devel@nongnu.org; Tue, 04 May 2010 12:23:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O9Ku2-0008DX-8D for qemu-devel@nongnu.org; Tue, 04 May 2010 12:23:23 -0400 Received: from mail-pv0-f173.google.com ([74.125.83.173]:47318) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O9Ku2-0008DK-3e for qemu-devel@nongnu.org; Tue, 04 May 2010 12:23:22 -0400 Received: by pvg11 with SMTP id 11so1689864pvg.4 for ; Tue, 04 May 2010 09:23:20 -0700 (PDT) Message-ID: <4BE049F5.6050105@codemonkey.ws> Date: Tue, 04 May 2010 11:23:17 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Patch to improve handling of server sockets References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Reinhard Max Cc: qemu-devel@nongnu.org, Gerd Hoffmann On 05/04/2010 08:49 AM, Reinhard Max wrote: > Hi, > > I am maintaining the tightvnc package for openSUSE and was recently > confronted with an alleged vnc problem with QWMU that turned out to be > a shortcoming in QEMU's code for handling TCP server sockets, which is > used by the vnc and char modules. > > The problem occurs when the address to listen on is given as a name > which resolves to multiple IP addresses the most prominent example > being "localhost" resolving to 127.0.0.1 and ::1 . > > The existing code stopped walking the list of addresses returned by > getaddrinfo() as soon as one socket was successfully opened and bound. > The result was that a qemu instance started with "-vnc localhost:42" > only listened on ::1, wasn't reachable through 127.0.0.1. The fact > that the code set the IPV6_V6ONLY socket option didn't help, because > that option only works when the socket gets bound to the IPv6 wildcard > address (::), but is useless for explicit address bindings. > > The attached patch against QEMU 0.11.0 extends inet_listen() to create > sockets for as many addresses from the address list as possible and > adapts its callers and their data structures to deal with a linked > list of socket FDs rather than a single file descriptor. > > So far I've only done some testing with the -vnc option. More testing > is needed in the qemu-char area and for the parts of the code that get > triggered from QEMU's Monitor. 0.11.0 is pretty old. Please update your patch against the latest git. But that said, I'm not sure we're doing the wrong thing right now. Gerd, what do you think about this behavior? Regards, Anthony Liguori > > Please review and comment. > > > cu > Reinhard > > P.S. Please keep me in Cc when replying.