From: Renzo Davoli <renzo@cs.unibo.it>
To: Samuel Thibault <samuel.thibault@gnu.org>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
virtualsquare@cs.unibo.it, thuth@redhat.com, jasowang@redhat.com,
Jan Kiszka <jan.kiszka@web.de>,
peter.maydell@linaro.org, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] libslirp and QEMU slirp
Date: Sun, 12 Feb 2017 08:30:19 +0100 [thread overview]
Message-ID: <20170212073019.GA25566@cs.unibo.it> (raw)
In-Reply-To: <20170208221050.GP2955@var.home>
Hi,
On Wed, Feb 08, 2017 at 11:10:50PM +0100, Samuel Thibault wrote:
> Hello,
>
> Stefan Hajnoczi, on Mon 06 Feb 2017 11:55:05 +0000, wrote:
> > I'm proposing this topic for discussion because there might be common
> > ground for Samuel from QEMU and the VDE folks to collaborate.
> >
> > Samuel: Should QEMU join forces with libslirp?
>
> Well, there are not that many forces from the QEMU side :)
Neither on VDE side ;-) but many ants can move mountains...
>
> - we are using timers for icmp announcements
> - qemu needs to be able to save/restore state, with compatibility with
> previous versions
libslirp is using qemu's slirp code.
If you try a diff between your "slirp" directory and libslirp's "src" directory
you'll find that there are only 3 lines added:
(at the date of the code extraction, e.g. qemu git's tag 1f8b56e7cebc71d80aec27a4760024b56acc957a)
In slirp.h:
#include <qemu2libslirp.h>
Which includes stubs and specific implementations to give slirp all the stuff
provided by qemu's core or other libraries used by qemu.
In tcp_subr.c:
400a401,403
> if ((ret = unixtcp_fconnect(so, af)) >= 0)
> return ret;
which adds a nice feature that IMHO would be useful in qemu, too.
unixtcp_fconnect creates a TCP to AF_UNIX socket redirection.
The VM running on qemu (or in VDE a VM connected to the virtual net)
can redirect a default route port (say 10.0.2.2:6000) to a UNIX socket
(say /tmp/.X11-unix/0). In this example X clients using the X display 10.0.2.2:0
can appear on the X server of the host.
Timers have been reimplemented using the qemu's API.
save/restore are dummy stubs in libslirp. Qemu's code is still there but it is not used
by libslirp.
In this way we can inherit all bugfixes and new feature from Qemu at almost no cost.
It would be a nice project to create a common codebase for libslirp.
The project sould be interesting for other VM projects (virtualbox-OSE?) and
maybe many others. We could collect several ants...
Libslirp/QEMU integration is not so difficult.
As a first step:
* Qemu could add the UNIX socket redirect feature, or at least a unixtcp_fconnect dummy function
returning -1 (#ifndef LIBSLIRP)
* #include <qemu2libslirp.h>
could be added in slirp.h (inside an #ifdef LIBSLIRP).
In this way we could share exactly the same codebase.
One further step:
* discuss how to reduce/eliminate qemu-specific dependence
* create an API for save/restore
These are only my two (euro)cents.
ciao
renzo
next prev parent reply other threads:[~2017-02-12 7:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 11:55 [Qemu-devel] libslirp and QEMU slirp Stefan Hajnoczi
2017-02-08 22:10 ` Samuel Thibault
2017-02-12 7:30 ` Renzo Davoli [this message]
2017-02-13 10:56 ` Thomas Huth
2017-02-13 11:21 ` Renzo Davoli
2017-02-15 14:33 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170212073019.GA25566@cs.unibo.it \
--to=renzo@cs.unibo.it \
--cc=jan.kiszka@web.de \
--cc=jasowang@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=samuel.thibault@gnu.org \
--cc=stefanha@gmail.com \
--cc=thuth@redhat.com \
--cc=virtualsquare@cs.unibo.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).