[libvirt] [PATCH] Blank out the 'listenAddr' parameter if empty string

Daniel P. Berrange berrange at redhat.com
Thu May 19 10:04:03 UTC 2011


On Thu, May 19, 2011 at 08:36:27AM +0800, Wen Congyang wrote:
> At 05/19/2011 01:08 AM, Daniel P. Berrange Write:
> > Some bogus apps are generating a VNC/SPICE/RFB listen attribute
> > with no content. This then causes a failure with the graphics
> > migration cookie parsing. Blank out the 'listenAddr' parameter
> > after parsing domain XML if it is the empty string, so the host
> > default takes over
> > 
> > * src/qemu/qemu_migration.c: Blank out listenAddr parameter
> >   if empty
> > ---
> >  src/conf/domain_conf.c |   13 +++++++++++++
> >  1 files changed, 13 insertions(+), 0 deletions(-)
> > 
> > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> > index 03f4dc9..15fe9f0 100644
> > --- a/src/conf/domain_conf.c
> > +++ b/src/conf/domain_conf.c
> > @@ -3906,6 +3906,10 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
> >          def->data.vnc.socket = virXMLPropString(node, "socket");
> >          def->data.vnc.keymap = virXMLPropString(node, "keymap");
> >  
> > +        if (def->data.vnc.listenAddr &&
> > +            STREQ(def->data.vnc.listenAddr, ""))
> > +            VIR_FREE(def->data.vnc.listenAddr);
> > +
> 
> Without this patch, the argument of qemu is '-vnc :<port>' if listenAddr is empty string.
> It means that we can connect it from any address.

It is just luck that this works with current QEMU. The 'listen'
attribute schema is for an IP address or hostname. The behavior
you see with '' may be compltely different for other QEMU versions,
or non-QEMU.

If you want to listen on any address, then use  listen='0.0.0.0'
which gives the same behaviour in an supported manner.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list