Bug 1029987 - spice-server reports incorrect listening address on monitor with "ipv6" option
Summary: spice-server reports incorrect listening address on monitor with "ipv6" option
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: 7.0
Assignee: Gerd Hoffmann
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 1029983
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-13 16:17 UTC by David Jaša
Modified: 2015-03-05 09:43 UTC (History)
14 users (show)

Fixed In Version: qemu 2.1
Doc Type: Bug Fix
Doc Text:
Clone Of: 1029983
Environment:
Last Closed: 2015-03-05 09:43:05 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0624 normal SHIPPED_LIVE Important: qemu-kvm-rhev security, bug fix, and enhancement update 2015-03-05 14:37:36 UTC

Description David Jaša 2013-11-13 16:17:12 UTC
version: spice-server-0.12.4-3.el7.x86_64


+++ This bug was initially created as a clone of Bug #1029983 +++

Description of problem:
"-spice ipv6" and "-spice addr=::" invocations are functionally equivalent (spice-server listens on address "::") but "-spice ipv6" reports listening address to be 0.0.0.0 instead of "::".

Version-Release number of selected component (if applicable):
spice-server-0.12.4-6.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. run two qemu-kvm processes with monitor with "-spice ipv6" and "-spice addr=::"
2. look at listening addresses using "info spice" monitor command
3. look at listening addresses using system tools (e.g. netstat)

Actual results:
address reported by "info spice" doesn't match address reported by netstat for "-spice ipv6" case

Expected results:
address reported by "info spice" matches the one from "netstat"

Additional info:
$ qemu-kvm -monitor stdio -vga qxl -spice ipv6,disable-ticketing,port=5800
iQEMU 0.12.1 monitor - type 'help' for more information
(qemu) info spice
Server:
     migrated: false
     address: 0.0.0.0:5800
        auth: none
Channels: none
(qemu) quit
$ qemu-kvm -monitor stdio -vga qxl -spice addr=::,disable-ticketing,port=5800
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info spice
Server:
     migrated: false
     address: :::5800
        auth: none
Channels: none
(qemu)

// both cases
# netstat -putna | grep 5800
tcp    0    0 :::5800    :::*    LISTEN      12564/qemu-kvm

Comment 1 Christophe Fergeau 2013-11-13 16:50:21 UTC
This is caused by that code in qemu/ui/spice-core.c:qmp_query_spice()

addr = qemu_opt_get(opts, "addr");
...
info->host = g_strdup(addr ? addr : "0.0.0.0");

Comment 2 Gerd Hoffmann 2013-12-09 11:42:09 UTC
Hmm, qemu doesn't know what spice-server is listening on, especially in case
nothing was explicitly configured (ipv4, ipv6 options) and it depends on
the host configuration whenever ipv6 or ipv6 is used by default.

So we could simply replace "0.0.0.0" with "*" wildcard.
Sounds ok?  Better suggestions?

Comment 3 David Jaša 2014-04-14 11:25:09 UTC
Reporting a wildcard is a good thing, simple and not misleading.

Comment 4 Gerd Hoffmann 2014-04-15 07:04:16 UTC
http://patchwork.ozlabs.org/patch/339171/

Comment 6 Gerd Hoffmann 2014-05-09 10:36:01 UTC
upstream commit 4f60af9ac00800d5833f6ec4317535aeaddb1616

Comment 8 FuXiangChun 2014-08-05 10:24:58 UTC
Reproduce this bug with qemu-kvm-1.5.3-66.el7.x86_64

# /usr/libexec/qemu-kvm -monitor stdio -vga qxl -spice ipv6,disable-ticketing,port=5800
QEMU 1.5.3 monitor - type 'help' for more information
(qemu) info spice 
Server:
     address: 0.0.0.0:5800
    migrated: false
        auth: none
    compiled: 0.12.4
  mouse-mode: server
Channels: none

# netstat -antpu|grep 5800
tcp6       0      0 :::5800                 :::*                    LISTEN      14780/qemu-kvm

so this bug can be reproduced.


Verify with qemu-kvm-rhev-2.1.0-3.el7ev.preview.x86_64

For amd & Intel host.

/usr/libexec/qemu-kvm -monitor stdio -vga qxl -spice ipv6,disable-ticketing,port=5800
QEMU 2.0.92 monitor - type 'help' for more information
(qemu) info spice
Server:
     address: *:5800
    migrated: false
        auth: none
    compiled: 0.12.4
  mouse-mode: server
Channels: none

# netstat -antpu|grep 5800
tcp6       0      0 :::5800                 :::*                    LISTEN      14970/qemu-kvm 

# /usr/libexec/qemu-kvm -monitor stdio -vga qxl -spice addr=::,disable-ticketing,port=5800

(qemu) info spice
Server:
     address: :::5800
    migrated: false
        auth: none
    compiled: 0.12.4
  mouse-mode: server
Channels: none

# netstat -antpu|grep 5800
tcp6       0      0 :::5800                 :::*                    LISTEN      15332/qemu-kvm

use spice client to connect to spice server via ipv4 or ipv6 address.

result:
spice client connected successfully.

Gerd,
QE need confirm two questions with you for this test result.
1. According to this test result, Is this bug fixed?

2. If specify ipv6('-spice ipv6' or '-spice addr=::'), then spice client can connect to spice server with ipv4 or ipv6 address. Conversely,If specify ipv4(-spice ipv4),then spice client only can use ipv4 address to connect spice server.  Is it expect?

Comment 10 Qian Guo 2014-08-26 05:53:45 UTC
Reproduce this bug with qemu-kvm-1.5.3-66.el7.x86_64

# /usr/libexec/qemu-kvm -monitor stdio -vga qxl -spice ipv6,disable-ticketing,port=5800
QEMU 1.5.3 monitor - type 'help' for more information
(qemu) info spice 
Server:
     address: 0.0.0.0:5800
    migrated: false
        auth: none
    compiled: 0.12.4
  mouse-mode: server
Channels: none

# netstat -antpu|grep 5800
tcp6       0      0 :::5800                 :::*                    LISTEN      14780/qemu-kvm

so this bug can be reproduced.

Verify this bug with qemu-kvm-rhev-2.1.0-2.el7.x86_64
# /usr/libexec/qemu-kvm -monitor stdio -vga qxl -spice ipv6,disable-ticketing,port=5900
QEMU 2.1.0 monitor - type 'help' for more information
(qemu) info spice
Server:
     address: *:5900
    migrated: false
        auth: none
    compiled: 0.12.4
  mouse-mode: server
Channels: none

# netstat -anp |grep 5900
tcp6       0      0 :::5900                 :::*                    LISTEN      17300/qemu-kvm      

So according to above, qemu-kvm replace "0.0.0.0" with "*" wildcard, so this bug has been fixed.

Additional infos:
Test with ipv6 address "::" and "::1" specified in cml
# /usr/libexec/qemu-kvm -monitor stdio -vga qxl -spice ipv6,addr=::,disable-ticketing,port=5900
QEMU 2.1.0 monitor - type 'help' for more information
(qemu) info spice
Server:
     address: :::5900
    migrated: false
        auth: none
    compiled: 0.12.4
  mouse-mode: server
Channels: none

# netstat -anp |grep 5900
tcp6       0      0 :::5900                 :::*                    LISTEN      17359/qemu-kvm 

# /usr/libexec/qemu-kvm -monitor stdio -vga qxl -spice ipv6,addr=::1,disable-ticketing,port=5900
QEMU 2.1.0 monitor - type 'help' for more information
(qemu) info spice
Server:
     address: ::1:5900
    migrated: false
        auth: none
    compiled: 0.12.4
  mouse-mode: server
Channels: none

# netstat -anp |grep 5900
tcp6       0      0 ::1:5900                :::*                    LISTEN      17373/qemu-kvm 

Under hmp, the spice server is using ipv6 format address, and listening ipv6 address with tcp port.

Comment 11 Gerd Hoffmann 2014-08-26 06:16:39 UTC
> Gerd,
> QE need confirm two questions with you for this test result.
> 1. According to this test result, Is this bug fixed?

Yes.

> 2. If specify ipv6('-spice ipv6' or '-spice addr=::'), then spice client can
> connect to spice server with ipv4 or ipv6 address. Conversely,If specify
> ipv4(-spice ipv4),then spice client only can use ipv4 address to connect
> spice server.  Is it expect?

ipv6 sockets allow ipv4 connects (when binding to the wildcard address), so this is normal behavior.

Comment 12 mazhang 2014-12-09 02:20:50 UTC
Hi Gerd,

You changed the component to qemu-kvm-rhev.Do you plan fix this bug on qemu-kvm ?
Since qemu-kvm still hit this problem.

Thanks,
Mazhang.

Comment 13 Gerd Hoffmann 2014-12-09 08:07:40 UTC
(In reply to mazhang from comment #12)
> Hi Gerd,
> 
> You changed the component to qemu-kvm-rhev.Do you plan fix this bug on
> qemu-kvm ?

Not planned, low priority bug.

Comment 15 errata-xmlrpc 2015-03-05 09:43:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0624.html


Note You need to log in before you can comment on or make changes to this bug.