[Slirp] gvisor netstack as an alternative to slirp

Marc-André Lureau marcandre.lureau at gmail.com
Fri Jan 3 09:00:12 UTC 2020


Hi

On Fri, Jan 3, 2020 at 12:38 PM Marek Majkowski <majek04 at gmail.com> wrote:
>
> (resent to slirp at lists.freedesktop.org mailing list)
>
> Good morning!
>
> There seem to be a wider discussion about the future of libslirp. Some
> suggest to use smoltcp [1]. I tried a different approach. I drafted a
> slirp4netns-alike code using gvisor netstack:
> https://gist.github.com/majek/778021e4f95f3e77ada5afcecacbd819
>
> The code is very rough, but shows the potential of netstack. The
> biggest problem I had with netstack is the routing setup.

This looks very promising!

(my PoC/hack using smoltcp was much more complicated:
https://gitlab.freedesktop.org/elmarco/smolirp/blob/master/src/slirp.rs
- beware it is quite broken as is)

>
> A) I wasn't able to get routing right, so opted out for assigning 0/0
> onto the tun interface internally in netstack. This results in ping's
> being accepted by netstack. Ping _anything_ from guest will always be
> responded by netstack. I'm not sure how to work around it. Perhaps
> extend netstack to have IcmpForwarder, just like we have
> tcp.Forwarder?
>
> B) I'm not sure how to do connection forwarding going from host to
> guest. This is again, mostly related to routing configuration.
>
> Let me know what you think.

Could you give some instructions on how to build it? (fwiw, qemu and
podman don't use TUN/TAP, but via fd, I'll try to adapt the code)

I think you should make it a standalone go project with a repo.

thanks



-- 
Marc-André Lureau


More information about the Slirp mailing list