From a0095d117227b00318e1321cf61bfa8b5b7aa74e Mon Sep 17 00:00:00 2001 From: fassl Date: Sat, 11 Sep 2021 16:00:25 +0200 Subject: [PATCH] man page and bump libslirp veresion: #259 Signed-off-by: fassl --- README.md | 8 ++++---- configure.ac | 2 +- slirp4netns.1 | 27 +++++++++++++++++++++++---- slirp4netns.1.md | 28 +++++++++++++++++++++------- 4 files changed, 49 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 239b5df..1f7e491 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# slirp4netns: User-mode networking for unprivileged network namespaces +# slirp4netns: User-mode networking for unprivileged network namespaces slirp4netns provides user-mode networking ("slirp") for unprivileged network namespaces. @@ -73,7 +73,7 @@ Also available as a package on almost all Linux distributions: * [Arch Linux](https://www.archlinux.org/packages/community/x86_64/slirp4netns/) * [openSUSE (since Leap 15.0)](https://build.opensuse.org/package/show/openSUSE%3AFactory/slirp4netns) * [SUSE Linux Enterprise (since 15)](https://build.opensuse.org/package/show/devel%3Akubic/slirp4netns) -* [Debian GNU/Linux (since 10.0)](https://packages.debian.org/buster/slirp4netns) +* [Debian GNU/Linux (since 10.0)](https://packages.debian.org/buster/slirp4netns) * [Ubuntu (since 19.04)](https://packages.ubuntu.com/search?keywords=slirp4netns) * [NixOS](https://github.com/NixOS/nixpkgs/tree/master/pkgs/tools/networking/slirp4netns) * [Gentoo Linux](https://packages.gentoo.org/packages/app-emulation/slirp4netns) @@ -126,7 +126,7 @@ starting slirp, MTU=65520 link/ether c2:28:0c:0e:29:06 brd ff:ff:ff:ff:ff:ff inet 10.0.2.100/24 brd 10.0.2.255 scope global tap0 valid_lft forever preferred_lft forever - inet6 fe80::c028:cff:fe0e:2906/64 scope link + inet6 fe80::c028:cff:fe0e:2906/64 scope link valid_lft forever preferred_lft forever (namespace)$ echo "nameserver 10.0.2.3" > /tmp/resolv.conf (namespace)$ mount --bind /tmp/resolv.conf /etc/resolv.conf @@ -187,7 +187,7 @@ $ make $ sudo make install ``` -* [libslirp](https://gitlab.freedesktop.org/slirp/libslirp) needs to be v4.1.0 or later. +* [libslirp](https://gitlab.freedesktop.org/slirp/libslirp) needs to be v4.4.0.57 or later. * To build `slirp4netns` as a static binary, run `./configure` with `LDFLAGS=-static`. * If you set `--prefix` to `$HOME`, you don't need to run `make install` with `sudo`. diff --git a/configure.ac b/configure.ac index 026f240..32ba351 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.69]) -AC_INIT([slirp4netns], [1.1.12+dev], [https://github.com/rootless-containers/slirp4netns/issues]) +AC_INIT([slirp4netns], [1.1.13+dev], [https://github.com/rootless-containers/slirp4netns/issues]) AC_CONFIG_SRCDIR([main.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/slirp4netns.1 b/slirp4netns.1 index b72bfe4..cb06dbc 100644 --- a/slirp4netns.1 +++ b/slirp4netns.1 @@ -1,4 +1,3 @@ -.nh .TH SLIRP4NETNS 1 "June 2021" "Rootless Containers" "User Commands" .SH NAME @@ -78,6 +77,14 @@ API socket path \fB\fC\-\-cidr\fR (since v0.3.0) specify CIDR, e.g. 10.0.2.0/24 +.PP +\fB\fC\-\-cidr6\fR (since v1.1.13, EXPERIMENTAL) +specify IPv6 CIDR, e.g. fd00::/64 + +.PP +\fB\fC\-\-ipv6\-random\fR (since v1.1.13, EXPERIMENTAL) +generate a random local IPv6 range + .PP \fB\fC\-\-disable\-host\-loopback\fR (since v0.3.0) prohibit connecting to 127.0.0.1:* on the host namespace @@ -199,7 +206,7 @@ starting slirp, MTU=65520 link/ether c2:28:0c:0e:29:06 brd ff:ff:ff:ff:ff:ff inet 10.0.2.100/24 brd 10.0.2.255 scope global tap0 valid\_lft forever preferred\_lft forever - inet6 fe80::c028:cff:fe0e:2906/64 scope link + inet6 fe80::c028:cff:fe0e:2906/64 scope link valid\_lft forever preferred\_lft forever (namespace)$ echo "nameserver 10.0.2.3" > /tmp/resolv.conf (namespace)$ mount \-\-bind /tmp/resolv.conf /etc/resolv.conf @@ -305,7 +312,7 @@ slirp4netns can provide QMP\-like API server over an UNIX socket file: .RE .PP -\fB\fCadd\_hostfwd\fR: Expose a port (IPv4 only) +\fB\fCadd\_hostfwd\fR: Expose a port (IPv4 and IPv6 if enabled and host\_addr is "0.0.0.0" or "::") .PP .RS @@ -318,6 +325,18 @@ slirp4netns can provide QMP\-like API server over an UNIX socket file: .fi .RE +.PP +\fB\fCadd\_hostfwd\fR: Expose a port (IPv4 only) + +.PP +specify \fB\fCtcp4\fR as \fB\fCproto\fR + +.PP +\fB\fCadd\_hostfwd\fR: Expose a port (IPv6 only) + +.PP +specify \fB\fCtcp6\fR as \fB\fCproto\fR + .PP If \fB\fChost\_addr\fR is not specified, then it defaults to "0.0.0.0". @@ -333,7 +352,7 @@ If \fB\fCguest\_addr\fR is not specified, then it will be set to the default add .nf (namespace)$ json='{"execute": "list\_hostfwd"}' (namespace)$ echo \-n $json | nc \-U /tmp/slirp4netns.sock -{"return": {"entries": [{"id": 42, "proto": "tcp", "host\_addr": "0.0.0.0", "host\_port": 8080, "guest\_addr": "10.0.2.100", "guest\_port": 80}]}} +{"return": {"entries": [{"id": 42, "proto": "tcp", "host\_addr": "0.0.0.0", "host\_addr6": "::", "host\_port": 8080, "guest\_addr": "10.0.2.100", "guest\_addr6": "fd00::100", "guest\_port": 80}]}} .fi .RE diff --git a/slirp4netns.1.md b/slirp4netns.1.md index f60b6b7..0dc19bb 100644 --- a/slirp4netns.1.md +++ b/slirp4netns.1.md @@ -55,6 +55,12 @@ API socket path `--cidr` (since v0.3.0) specify CIDR, e.g. 10.0.2.0/24 +`--cidr6` (since v1.1.13, EXPERIMENTAL) +specify IPv6 CIDR, e.g. fd00::/64 + +`--ipv6-random` (since v1.1.13, EXPERIMENTAL) +generate a random local IPv6 range + `--disable-host-loopback` (since v0.3.0) prohibit connecting to 127.0.0.1:\* on the host namespace @@ -139,7 +145,7 @@ starting slirp, MTU=65520 link/ether c2:28:0c:0e:29:06 brd ff:ff:ff:ff:ff:ff inet 10.0.2.100/24 brd 10.0.2.255 scope global tap0 valid_lft forever preferred_lft forever - inet6 fe80::c028:cff:fe0e:2906/64 scope link + inet6 fe80::c028:cff:fe0e:2906/64 scope link valid_lft forever preferred_lft forever (namespace)$ echo "nameserver 10.0.2.3" > /tmp/resolv.conf (namespace)$ mount --bind /tmp/resolv.conf /etc/resolv.conf @@ -207,7 +213,7 @@ slirp4netns can provide QMP-like API server over an UNIX socket file: (host)$ slirp4netns --api-socket /tmp/slirp4netns.sock ... ``` -`add_hostfwd`: Expose a port (IPv4 only) +`add_hostfwd`: Expose a port (IPv4 and IPv6 if enabled and host_addr is "0.0.0.0" or "::") ```console (namespace)$ json='{"execute": "add_hostfwd", "arguments": {"proto": "tcp", "host_addr": "0.0.0.0", "host_port": 8080, "guest_addr": "10.0.2.100", "guest_port": 80}}' @@ -215,6 +221,14 @@ slirp4netns can provide QMP-like API server over an UNIX socket file: {"return": {"id": 42}} ``` +`add_hostfwd`: Expose a port (IPv4 only) + +specify `tcp4` as `proto` + +`add_hostfwd`: Expose a port (IPv6 only) + +specify `tcp6` as `proto` + If `host_addr` is not specified, then it defaults to "0.0.0.0". If `guest_addr` is not specified, then it will be set to the default address that corresponds to `--configure`. @@ -224,7 +238,7 @@ If `guest_addr` is not specified, then it will be set to the default address tha ```console (namespace)$ json='{"execute": "list_hostfwd"}' (namespace)$ echo -n $json | nc -U /tmp/slirp4netns.sock -{"return": {"entries": [{"id": 42, "proto": "tcp", "host_addr": "0.0.0.0", "host_port": 8080, "guest_addr": "10.0.2.100", "guest_port": 80}]}} +{"return": {"entries": [{"id": 42, "proto": "tcp", "host_addr": "0.0.0.0", "host_addr6": "::", "host_port": 8080, "guest_addr": "10.0.2.100", "guest_addr6": "fd00::100", "guest_port": 80}]}} ``` `remove_hostfwd`: Remove an exposed port @@ -243,7 +257,7 @@ Remarks: * A request must be less than 4096 bytes. * JSON responses may contain `error` instead of `return`. -# DEFINED NAMESPACE PATHS +# DEFINED NAMESPACE PATHS A user can define a network namespace path as opposed to the default process ID: ```console @@ -256,14 +270,14 @@ Additionally, a `--userns-path=PATH` argument can be included to override any us (host)$ slirp4netns --netns-type=path --userns-path=/path/to/userns /path/to/netns tap0 ``` -# OUTBOUND ADDRESSES -A user can defined preferred outbound ipv4 and ipv6 address in multi IP scenarios. +# OUTBOUND ADDRESSES +A user can defined preferred outbound ipv4 and ipv6 address in multi IP scenarios. ```console (host)$ slirp4netns --outbound-addr=10.2.2.10 --outbound-addr6=fe80::10 ... ``` -Optionally you can use interface names instead of ip addresses. +Optionally you can use interface names instead of ip addresses. ```console (host)$ slirp4netns --outbound-addr=eth0 --outbound-addr6=eth0 ...