This service will be undergoing disruptive maintenance at 7:00PM UTC, 2020-01-18. It is expected to last approximately one hour.
Bug 624626 - Failed to conduct remote ssh connection test via ipv6 ip
Summary: Failed to conduct remote ssh connection test via ipv6 ip
Keywords:
Status: CLOSED DUPLICATE of bug 785164
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.0
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Daniel Veillard
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 670725 (view as bug list)
Depends On:
Blocks: 756082 785164
TreeView+ depends on / blocked
 
Reported: 2010-08-17 09:56 UTC by xhu
Modified: 2018-11-28 21:48 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-27 22:15:54 UTC
Target Upstream Version:


Attachments (Terms of Use)
Demonstrate missing escaping of ':' in hostnames (650 bytes, text/plain)
2010-08-17 11:11 UTC, Daniel Berrangé
no flags Details

Description xhu 2010-08-17 09:56:48 UTC
Description of problem:
Failed to conduct remote ssh connection test via ipv6.

Version-Release number of selected component (if applicable):
kernel-2.6.32-63.el6.x86_64
libvirt-client-0.8.1-25.el6.x86_64
qemu-kvm-0.12.1.2-2.109.el6.x86_64

How reproducible:
everytime

Steps to Reproduce:
You must have two machine: one client and one server
1. 
1.1 on client host
configure ipv6 global addr:
#ifconfig eth0 inet6 add 3ffe::101
1.2 on server host
configure ipv6 global addr
#ifconfig eth0 inet6 add 3ffe::102

2. 
on client host, execute remote access and issue the bellow command:
# virsh -c qemu+ssh://[3ffe::102]/system
error: cannot recv data: ssh: Could not resolve hostname [3ffe::102]: Name or service not known
: Connection reset by peer
error: failed to connect to the hypervisor

Actual results:
failed to conduct remote ssh connection test via ipv6

Expected results:
should conduct remote ssh connection test via ipv6 successfully

Additional info:
results for command "strace -s 1000 -f -e trace=execve virsh -c qemu+ssh://[3ffe::102]/system"
# strace -s 1000 -f -e trace=execve virsh -c qemu+ssh://[3ffe::102]/system
execve("/usr/bin/virsh", ["virsh", "-c", "qemu+ssh://[3ffe::102]/system"], [/* 48 vars */]) = 0
Process 27895 attached
[pid 27895] execve("/usr/lib64/qt-3.3/bin/ssh", ["ssh", "[3ffe::102]", "nc", "-U", "/var/run/libvirt/libvirt-sock"], [/* 48 vars */]) = -1 ENOENT (No such file or directory)
[pid 27895] execve("/usr/local/bin/ssh", ["ssh", "[3ffe::102]", "nc", "-U", "/var/run/libvirt/libvirt-sock"], [/* 48 vars */]) = -1 ENOENT (No such file or directory)
[pid 27895] execve("/usr/bin/ssh", ["ssh", "[3ffe::102]", "nc", "-U", "/var/run/libvirt/libvirt-sock"], [/* 48 vars */]) = 0
Process 27895 detached
--- SIGCHLD (Child exited) @ 0 (0) ---
error: cannot recv data: ssh: Could not resolve hostname [3ffe::102]: Name or service not known
: Connection reset by peer
error: failed to connect to the hypervisor

Comment 2 Daniel Berrangé 2010-08-17 10:14:39 UTC
The '[3ffe::102]' hostname libvirt passes to SSH here is coming from

    priv->hostname = strdup (conn->uri && conn->uri->server ?
                             conn->uri->server : "localhost");


The conn->uri is the xmlURIPtr struct with the parsed URI. The '[' and ']' are *not* part of the hostname, they are the special URI string encoding for numeric addresses, and thus shouldn't have been in the xmlURIPtr parsed hostname. Thus this looks like a libxml bug to me.

Comment 3 RHEL Program Management 2010-08-17 10:18:44 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **

Comment 4 Daniel Berrangé 2010-08-17 11:11:40 UTC
Created attachment 439089 [details]
Demonstrate missing escaping of ':' in hostnames

This demo program shows the escaping problem in xmlURIPtr handling. While it correctly escapes & unescapes '?' in the path component, it does not escape or unescape ':' in the server component. In this example program, libxml2 generates a URI that it cannot then parse, because it misses the '[' and ']' to protect the hostname containing ':'. Even if it had added these, it then fails to remove them when parsing.

Comment 5 RHEL Program Management 2010-08-18 21:18:37 UTC
Thank you for your bug report. This issue was evaluated for inclusion
in the current release of Red Hat Enterprise Linux. Unfortunately, we
are unable to address this request in the current release. Because we
are in the final stage of Red Hat Enterprise Linux 6 development, only
significant, release-blocking issues involving serious regressions and
data corruption can be considered.

If you believe this issue meets the release blocking criteria as
defined and communicated to you by your Red Hat Support representative,
please ask your representative to file this issue as a blocker for the
current release. Otherwise, ask that it be evaluated for inclusion in
the next minor release of Red Hat Enterprise Linux.

Comment 6 Laine Stump 2011-01-22 19:39:55 UTC
*** Bug 670725 has been marked as a duplicate of this bug. ***

Comment 18 Dave Allan 2012-02-22 13:23:24 UTC
What's the correct fix here?  It doesn't matter at all to me where a fix gets done, either in libxml2 or libvirt, but libvirt is broken until we have a solution.

Comment 19 Daniel Berrangé 2012-02-22 13:31:18 UTC
IMHO we need to deal with this in libvirt.

Comment 20 Dave Allan 2012-02-22 19:42:31 UTC
Ok, I've changed the component to libvirt.

Comment 22 Dave Allan 2012-02-27 21:09:20 UTC
DV, what's going on with this BZ?

Comment 23 Eric Blake 2012-02-27 22:09:04 UTC
This upstream commit should solve things:

commit 9f748277bbd17d031f80d28e6d2fc4b52e8d5715
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Fri Feb 24 19:48:55 2012 +0100

    Fixed URI parsing
    
    Function xmlParseURI does not remove square brackets around IPv6
    address when parsing. One of the solutions is making wrappers around
    functions working with xmlURI*. This assures that uri->server will be
    always properly assigned and it doesn't have to be changed when used
    on some new place in the code.
    For this purpose, functions virParseURI and virSaveURI were
    added. These function are wrappers around xmlParseURI and xmlSaveUri
    respectively.
    Also there is one new syntax check function to prohibit these functions
    anywhere else.
    
    File changes:
     - src/util/viruri.h        -- declaration
     - src/util/viruri.c        -- definition
     - src/libvirt_private.syms -- symbol export
     - src/Makefile.am          -- added source and header files
     - cfg.mk                   -- added sc_prohibit_xmlURI
     - all others               -- ID name and include fixes

Comment 24 Dave Allan 2012-02-27 22:15:54 UTC
Ok, I'm closing this as a dup of BZ 785164

*** This bug has been marked as a duplicate of bug 785164 ***


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