[libvirt] [PATCHv2 0/5] Add API to allow TCP connection tunelling

Peter Krempa pkrempa at redhat.com
Mon Dec 10 08:29:39 UTC 2012


This series adds ability for the qemu driver to tunnel connections to TCP
ports from the host. This is useful for enabling remote VNC/SPICE sessions
without the need to configure SSH tunnels or portforwards and without the
need to open the ports for public.

There's also an advantage for tools such as virt-viewer that have to guess the remote
connection parameters and you have to hope that nothing is in your way. With
spice/VNC clients that have support for read/write callbacks, this would allow also
direct connection without an intermediate socket.

The API and tunelling works but there's no (stable and good working) client for
this API. I hacked up a dirty netcat-like terminal into virsh for testing
purposes (see patch 5/5) but that isn't what I'd like to see.

The client should be able to open a listening socket and when a client connects
to it, it opens a stream and connects it to the remote host.

For the client there are two options:
1) do all the stuff in virsh: + one tool to rule them all
                              - i'd like to daemonize it and I don't know if that's okay in virsh

2) add a new tool "virtunnel": + less virsh pollution
                               - separate tool ...

As nobody responded, I'd like to re-ask for someones opinion on this.


(note: this is my personal effort, I'm annoyed of opening ssh tunnels to remote displays on my server
 and I don't want to open the ports to public. )

After this it would be great to add support for this to virt-viewer. I will have a look at that later.

----
Diff to v1:
- fixed error reporting in 2/5
- documented limitation to "localhost" in 3/5
- fixed possible segfault in 4/5
---

Peter Krempa (5):
  api: Add API to allow TCP tunneling through streams to the host
  fdstream: Add support for TCP connections of streams
  qemu: Add configuration options to enable TCP tunelling
  qemu: Implement virNodeTunnelTcp for the qemu driver
  NOT_TO_BE_APPLIED_UPSTREAM: quick and dirty virsh client to test the 
       stuff

 include/libvirt/libvirt.h.in | 11 +++++++
 src/driver.h                 |  8 +++++
 src/fdstream.c               | 73 ++++++++++++++++++++++++++++++++++++++++++++
 src/fdstream.h               |  5 +++
 src/libvirt.c                | 67 ++++++++++++++++++++++++++++++++++++++++
 src/libvirt_private.syms     |  1 +
 src/libvirt_public.syms      |  1 +
 src/qemu/qemu.conf           | 16 ++++++++++
 src/qemu/qemu_conf.c         | 26 ++++++++++++++++
 src/qemu/qemu_conf.h         | 13 ++++++++
 src/qemu/qemu_driver.c       | 48 +++++++++++++++++++++++++++++
 src/remote/remote_driver.c   |  1 +
 src/remote/remote_protocol.x |  9 +++++-
 src/remote_protocol-structs  |  6 ++++
 src/rpc/gendispatch.pl       |  1 +
 tools/console.c              | 66 +++++++++++++++++++++------------------
 tools/console.h              |  9 ++----
 tools/virsh-domain.c         | 17 +++++++++--
 tools/virsh-host.c           | 60 ++++++++++++++++++++++++++++++++++++
 19 files changed, 397 insertions(+), 41 deletions(-)

-- 
1.8.0




More information about the libvir-list mailing list