qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [RESEND][PATCH] gdbstub: listen on ipv4 address


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] Re: [RESEND][PATCH] gdbstub: listen on ipv4 address
Date: Wed, 28 Jan 2009 10:38:58 +0000
User-agent: Mutt/1.4.1i

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 :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]