RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1025407 - autoport='yes' doesn't skip over ports in use with IPv6
Summary: autoport='yes' doesn't skip over ports in use with IPv6
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-31 15:38 UTC by Ján Tomko
Modified: 2016-04-26 15:42 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.7-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 07:25:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0323 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2015-03-05 12:10:54 UTC

Description Ján Tomko 2013-10-31 15:38:09 UTC
Description of problem:
autoport='yes' doesn't skip over ports in use with IPv6

Version-Release number of selected component (if applicable):
libvirt-1.1.1-10.el7

How reproducible:
100%

Steps to Reproduce:
1. Listen on IPv6-only on the first display port without libvirtd's knowlege. Either:
a) start a domain with <graphics listen="::1" autoport="yes">
and restart libvirtd
or b) nc -6 -l -p 5900
2. Try to start another domain with <graphics listen="::1" autoport="yes">

Actual results:
error: Failed to start domain f19live
error: internal error: process exited while connecting to monitor: ((null):15085): Spice-Warning **: reds.c:3037:reds_init_socket: reds_init_socket: binding socket to ::1:5900 failed
qemu-kvm: failed to initialize spice server

Expected results:
Another port is assigned and domain starts successfully.

Additional info:
v1 of the patches proposed upstream:
https://www.redhat.com/archives/libvir-list/2013-October/msg00007.html

Comment 2 Ján Tomko 2013-10-31 15:41:11 UTC
v2 posted upstream:
https://www.redhat.com/archives/libvir-list/2013-October/msg01313.html

Comment 4 Ján Tomko 2014-02-14 12:53:16 UTC
v3 of the patchset:
https://www.redhat.com/archives/libvir-list/2014-February/msg00325.html

Now pushed upstream:
commit 0ee9081215be8a11a5b31c5442b039d12466a0ae
Author:     Ján Tomko <jtomko>
CommitDate: 2014-02-14 13:18:35 +0100

    Support IPv6 in port allocator
    
    Also try to bind on IPv6 to check if the port is occupied.
    
    Change the mocked bind in the test to return EADDRINUSE
    for some ports only for the IPv4/IPv6 socket if we're testing
    on a host with IPv6 compiled in.
    
    Also mock socket() to make it fail with EAFNOTSUPPORTED
    if LIBVIRT_TEST_IPV4ONLY is set in the environment, to
    simulate a host without IPv6 support in the kernel. The
    tests are repeated again with this variable set.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1025407

commit 531bc0bbd049a22141af98e833abe8acfd610585
Author:     Ján Tomko <jtomko>
CommitDate: 2014-02-14 13:18:35 +0100

    Split out bind() from virPortAllocatorAcquire

git describe: v1.2.1-213-g0ee9081

Comment 7 Luyao Huang 2014-11-20 02:28:37 UTC
I can reproduce this bug with libvirt-1.1.1-29.el7.x86_64:

# virsh dumpxml etsd|grep ::1
    <graphics type='spice' port='5900' autoport='yes' listen='::1'>
      <listen type='address' address='::1'/>
# virsh dumpxml etsd2|grep ::1
    <graphics type='spice' autoport='yes' listen='::1'>
      <listen type='address' address='::1'/>

# virsh start etsd
Domain etsd started


# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh start etsd2
error: Failed to start domain etsd2
error: internal error: process exited while connecting to monitor: ((null):16242): Spice-Warning **: reds.c:3070:reds_init_socket: reds_init_socket: binding socket to ::1:5900 failed
qemu-kvm: failed to initialize spice server

And verify this bug with libvirt-1.2.8-7.el7.x86_64 :

# virsh dumpxml etsd|grep ::1
    <graphics type='spice' port='5900' autoport='yes' listen='::1'>
      <listen type='address' address='::1'/>
# virsh dumpxml etsd2|grep ::1
    <graphics type='spice' autoport='yes' listen='::1'>
      <listen type='address' address='::1'/>

# virsh start etsd
Domain etsd started

# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh start etsd2
Domain etsd2 started

Also test with vnc.

Comment 8 Luyao Huang 2014-11-20 02:30:36 UTC
Forgot this :

# virsh start etsd2
Domain etsd2 started

# netstat -ntap|grep qemu
tcp6       0      0 ::1:5900                :::*                    LISTEN      17671/qemu-kvm      
tcp6       0      0 ::1:5901                :::*                    LISTEN      17805/qemu-kvm

Comment 10 errata-xmlrpc 2015-03-05 07:25:30 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-0323.html


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