[libvirt] [Spice-devel] RFC: spice-server default listen behaviour change

David Jaša djasa at redhat.com
Fri Jun 15 13:33:57 UTC 2012


David Jaša píše v Pá 15. 06. 2012 v 15:10 +0200:
> Daniel P. Berrange píše v Pá 15. 06. 2012 v 11:54 +0100:
> > On Fri, Jun 15, 2012 at 12:44:04PM +0200, Gerd Hoffmann wrote:
> > > On 06/15/12 12:00, Daniel P. Berrange wrote:
> > > > On Fri, Jun 15, 2012 at 11:48:28AM +0200, Gerd Hoffmann wrote:
> > > >>   Hi,
> > > >>
> > > >>> * new spice-server feature: add option to bind to a selected interface
> > > >>> regardless of its addresses
> > > >>
> > > >> How does that work?
> > > > 
> > > > I presume the client app would request    listen=eth0, and the QEMU
> > > > would have to call getifaddrs() to determine what IP addresses
> > > > currently correspond to eth0.
> > > 
> > > Ah, so there isn't a direct way I'm not aware of, you still bind to a
> > > specific ip address (or multiple), just specified in a different way ;)
> > > 
> > > Note that supporting this isn't going to work with a single listening
> > > socket.  Having ipv6 sockets accept ipv4 connects too works for wildcard
> > > sockets only.  If you want listening on all ip{v4,v6} addresses of an
> > > interface you'll need a listening socket for each.
> > 
> > Yeah, I'm almost certain you'll need to have multiple listening sockets
> > for this to work
> > 
> > Daniel
> 
> Well, I've checked what my local dnsmasq does and it's doing precisely
> what you say:
> tcp        0      0 127.0.0.1:53                0.0.0.0:*                   LISTEN      29426/dnsmasq       
> tcp        0      0 192.168.122.1:53            0.0.0.0:*                   LISTEN      29426/dnsmasq       
> tcp        0      0 ::1:53                      :::*                        LISTEN      29426/dnsmasq       
> tcp        0      0 fe80::4c03:d0ff:fec2:aa7:53 :::*                        LISTEN      29426/dnsmasq
> 
> In other words, dual-socket won't make dual-stack for selected interface
> possible without implementing
> https://bugzilla.redhat.com/show_bug.cgi?id=787256
> anyway. :(
> 
> David
> 

Scratch that. After some more research, I found this in socket (7):

SO_BINDTODEVICE
      Bind  this  socket to a particular device like "eth0", as speci-
      fied in the passed interface name.  If  the  name  is  an  empty
      string  or  the option length is zero, the socket device binding
      is removed.  The passed option is a variable-length  null-termi-
      nated  interface  name string with the maximum size of IFNAMSIZ.
      If a socket is bound to an interface, only packets received from
      that  particular  interface  are  processed by the socket.  Note
      that this only works for some socket types, particularly AF_INET
      sockets.   It  is  not  supported for packet sockets (use normal
      bind(8) there)

So using wildcard address and this socket option should be the
least-effort way to support dual-stack display networks if I get it
right...

David

-- 

David Jaša, RHCE

SPICE QE based in Brno
GPG Key:     22C33E24 
Fingerprint: 513A 060B D1B4 2A72 7F0D 0278 B125 CD00 22C3 3E24






More information about the libvir-list mailing list