[Slirp] VDE convergence to liblisrp
Renzo Davoli
renzo at cs.unibo.it
Mon Dec 30 18:04:56 UTC 2019
Dear developers and maintainers of libslirp.
First of all thank you for the project.
I am the main developer of VDE including the former libslirp proposal(1) and a slirp plugin for vde
based on it(2).
Both these projects are now deprecated as I have reimplemented these features based on your library.
More precisely I have implemented:
* libvdeslirp(3): a library that makes extremely simple to write Linux tools using (your) libslirp.
libvdeslirp:
- provides a simple way to set up a default configuration (that fits 90% of common usages)
- starts a thread for the stack management, taking care of the pollfd array, timers (those
used for ipv6's router advertisements)
- in short it is almost a drop-in replacements for tools using tuntap. Just use vdeslirp_init to
open the stream, vdeslirp_send/vdeslirp_recv to send (virtual) ethernet packets, vdeslirp_fd
provides a file descriptor for poll/select and vdeslirp_close teminates the service.
(the library can manage several slirp instances concurrently if needed).
* vdeplug_slirp:(4):
This is the new slirp plugin for vdeplug4(5), based on libvdeslirp and thus on libslirp.
The following session creates a vdens(6) namespace using slirp:
--------------
$ vdens -R 10.0.2.3 slirp://
$ ## inside the namespace!
$ ip link
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: vde0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 7e:d0:82:18:ec:0a brd ff:ff:ff:ff:ff:ff
$ /sbin/udhcpc -i vde0
udhcpc: started, v1.30.1
udhcpc: sending discover
udhcpc: sending select for 10.0.2.15
$ ip addr
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: vde0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
link/ether 7e:d0:82:18:ec:0a brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global vde0
valid_lft forever preferred_lft forever
inet6 fd00::7cd0:82ff:fe18:ec0a/64 scope global dynamic mngtmpaddr
valid_lft 86393sec preferred_lft 14393sec
inet6 fe80::7cd0:82ff:fe18:ec0a/64 scope link
valid_lft forever preferred_lft forever
$ ## the following command is just an example of an application opening a TCP stream
$ ssh remote.machine.org
remote.machine$ ....
remote.machine$ logout
$
--------------
I have just submitted a merge proposal for your libslirp to add two useful features for vde users (and not only).
* forward to UNIX socket. (slirp_add_unix) It is similar to slirp_add_exec but instead of spawning a
command it opens a UNIX stream socket. It is useful for example to allow X clients running on a VM or
in a namespace to use the X-window server of the host.
e.g. the diversion of 10.0.2.4:6000 to /tmp/.X11-unix/X0 allows all clients using -display 10.0.2.4:0 to
run their graphical interface on the X-server :0 on the host
* remove (guest addr) forward services: While slirp_remove_hostfwd removes a forward service activated by
slirp_add_hostfwd, slirp_add_exec and slirp_add_guestfwd (and the new slirp_add_unix) do not have a
remove function. The proposed patch adds the function "slirp_remove_guestfwd".
Happy new (hacking) year.
renzo
Repositography:
(1) https://github.com/rd235/libslirp
(2) https://github.com/rd235/vdeplug_slirp
(3) https://github.com/virtualsquare/libvdeslirp
(4) https://github.com/virtualsquare/vdeplug_slirp
(5) https://github.com/rd235/vdeplug4
(6) https://github.com/rd235/vdens
--
================================================================================
Renzo Davoli | Computer Science and Engineering Dept.
(NIC rd235, HAM IZ4DJE) | University of Bologna
Tel. +39 051 2094501 | Mura Anteo Zamboni, 7
Fax. +39 051 2094510 | I-40126 Bologna ITALY
Key fingerprint = BAF1 7B2F F82F 3F11 4DFE E114 2C65 F79E D328 E61B
================================================================================
More information about the Slirp
mailing list