From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LS7qp-00068a-0N for qemu-devel@nongnu.org; Wed, 28 Jan 2009 05:40:55 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LS7qm-000678-Ro for qemu-devel@nongnu.org; Wed, 28 Jan 2009 05:40:54 -0500 Received: from [199.232.76.173] (port=39705 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LS7qm-00066w-LN for qemu-devel@nongnu.org; Wed, 28 Jan 2009 05:40:52 -0500 Received: from mx1.redhat.com ([66.187.233.31]:53635) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LS7qm-0005Mm-9O for qemu-devel@nongnu.org; Wed, 28 Jan 2009 05:40:52 -0500 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n0SAdZ2J021180 for ; Wed, 28 Jan 2009 05:39:55 -0500 Received: from file.fab.redhat.com (file.fab.redhat.com [10.33.63.6]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n0SAd1fM007706 for ; Wed, 28 Jan 2009 05:39:11 -0500 Received: from file.fab.redhat.com (localhost.localdomain [127.0.0.1]) by file.fab.redhat.com (8.13.1/8.13.1) with ESMTP id n0SAcwDQ013326 for ; Wed, 28 Jan 2009 10:38:58 GMT Received: (from berrange@localhost) by file.fab.redhat.com (8.13.1/8.13.1/Submit) id n0SAcwth013322 for qemu-devel@nongnu.org; Wed, 28 Jan 2009 10:38:58 GMT Date: Wed, 28 Jan 2009 10:38:58 +0000 From: "Daniel P. Berrange" Subject: Re: [Qemu-devel] Re: [RESEND][PATCH] gdbstub: listen on ipv4 address Message-ID: <20090128103858.GD1213@redhat.com> References: <6DF473C7837D4A31A3A6AF10F70F0F63@FSCPC> <497E350B.6080003@codemonkey.ws> <60118371B6BE4B52AEAE1C778543354A@FSCPC> <497F9177.6050008@codemonkey.ws> <498021EE.5060801@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <498021EE.5060801@siemens.com> Reply-To: "Daniel P. Berrange" , qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Wed, Jan 28, 2009 at 10:14:22AM +0100, Jan Kiszka wrote: > Anthony Liguori wrote: > > Sebastian Herbszt wrote: > >> Anthony Liguori wrote: > >>> Sebastian Herbszt wrote: > >>>> Make gdbstub listen on ipv4 address like before r5697. > >>> > >>> Any reason to make it explicit? > >> > >> There seems to be no support for IPv6 in gdb. > > > > Are you unable to connect without the ipv4 option? My understanding was > > that we shouldn't explicitly need this option. > > inet_listen (which is finally called for this) falls back to PF_UNSPEC > when no protocol is given. I'm not sure if we can expect (according to > specs) that all our host OSes pick the protocol we want (normally IPv4). There are three scenarios you need to consider wrt command line args for TCP - IP address - the parser determines whether it IPv4 or V6 address and asets PF_INET / PF_INET6 as needed - Hostname - with PF_UNSPEC, and AI_ADDRCONFIG, getaddrinfo() will resolve the name, and return zero or more IP addresses. An IPv6 address is only returned if a NIC has IPv6 enabled. An IPv4 address is only returned if a NIC has IPv4 enabled. QEMU listens on the first address it gets If an IPv6 address is returned, QEMU *disables* IPV6_V6ONLY socket option, so the kernel also accepts IPv4 connections on the IPv6 socket. - No hostname - with PF_UNSPEC, and AI_ADDRCONFIG, getaddrinf() will return the 0.0.0.0 or :: depending on whether the host has IPv6 enabled on any NICs. Again QEMU disables IPV6_V6ONLY to ensure IPv4 connections can be accepted over the IPv6 socket Finally the ipv4/v6 command line flags in QEMU can override the normal getaddrinfo() config. The GDB stub current code should be hitting scenario 3, and thus QEMU should be listening on both IPv4 and IPv6 ports. If everything is working as I describe above, we should not need any special case to force disable IPv6 for GDB stub, even if GDB itself is IPv4 only - we always listen on IPv4 address even if we're also listening on IPv6, unless the command line explicitly has the ',ipv6' flag provided. If this isn't working, then perhaps our call to disable the IPV6_V6ONLY socket option is not working correctly on some OS ? Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|