Bug 1029983

Summary: spice-server reports incorrect listening address on monitor with "ipv6" option
Product: Red Hat Enterprise Linux 6 Reporter: David Jaša <djasa>
Component: qemu-kvmAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.5CC: bsarathy, cfergeau, chayang, dblechte, juzhang, mazhang, mkenneth, qzhang, rbalakri, rhod, rh-spice-bugs, virt-maint
Target Milestone: rc   
Target Release: 6.6   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.426.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1029987 (view as bug list) Environment:
Last Closed: 2014-10-14 06:54:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1029987    

Description David Jaša 2013-11-13 16:13:54 UTC
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:47:57 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 David Jaša 2013-11-14 14:40:02 UTC
(In reply to Christophe Fergeau from comment #1)
> 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");

That doesn't sound particularly useful. Does spice-server proper has some means to dump the actual listening address?

Comment 3 mazhang 2013-11-20 05:34:45 UTC
Reproduce this bug with spice-server-0.12.4-6.el6.x86_64.

host:
RHEL6.5-20131105.6
kernel-2.6.32-431.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.415.el6_5.3.x86_64

steps:
1 run qemu-kvm with following cmdline

[root@m2 ~]# /usr/libexec/qemu-kvm -monitor stdio -vga qxl -spice ipv6,disable-ticketing,port=5900
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info spice 
Server:
     migrated: false
     address: 0.0.0.0:5900
        auth: none
Channels: none
(qemu) q
[root@m2 ~]# /usr/libexec/qemu-kvm -monitor stdio -vga qxl -spice addr=::,disable-ticketing,port=5900
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info spice 
Server:
     migrated: false
     address: :::5900
        auth: none
Channels: none
(qemu) 

Result:
listening address to be 0.0.0.0 instead of "::" with "-spice ipv6"

Comment 4 Gerd Hoffmann 2014-04-14 09:21:24 UTC
See also: bug 1029987 (rhel7 version of this one, sitting in needinfo, waiting for feedback from reporter).

Comment 5 Gerd Hoffmann 2014-05-09 10:35:18 UTC
upstream commit 4f60af9ac00800d5833f6ec4317535aeaddb1616

Comment 7 Gerd Hoffmann 2014-05-09 11:01:15 UTC
patch posted.

Comment 8 Jeff Nelson 2014-05-19 20:03:15 UTC
Fix included in qemu-kvm-0.12.1.2-2.426.el6

Comment 10 mazhang 2014-07-03 07:35:07 UTC
Reproduce this bug on qemu-kvm-0.12.1.2-2.415.el6.x86_64.

Steps:
[root@dhcp-8-102 ~]# # /usr/libexec/qemu-kvm -monitor stdio -vga qxl -spice ipv6,disable-ticketing,port=5900
# /usr/libexec/qemu-kvm -monitor stdio -vga qxl -spice ipv6,disable-ticketing,port=5900
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info spice
Server:
     migrated: false
     address: 0.0.0.0:5900
        auth: none
Channels: none
(qemu) q


Verified this bug on qemu-kvm-0.12.1.2-2.428.el6.x86_64.

[root@dhcp-8-102 ~]# /usr/libexec/qemu-kvm -monitor stdio -vga qxl -spice ipv6,disable-ticketing,port=5900
QEMU 0.12.1 monitor - type 'help' for more information
(qemu) info spice
Server:
     migrated: false
     address: *:5900
        auth: none
Channels: none
(qemu) q

# netstat -putna |grep 5900
tcp        0      0 :::5900                     :::*                        LISTEN      20142/qemu-kvm      

As 1029987#c2 and 1029987#c3 mentioned, qemu-kvm replace "0.0.0.0" with "*" wildcard, so this bug has been fixed.

Comment 11 errata-xmlrpc 2014-10-14 06:54:25 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.

http://rhn.redhat.com/errata/RHBA-2014-1490.html