Skip to content

Commit af13bc4

Browse files
pfandlDigitalDJ
authored andcommitted
- implement forwarding - implement random CIDR Signed-off-by: Jasmin Fazlic <[email protected]>
1 parent 9996a4e commit af13bc4

17 files changed

+1096
-71
lines changed

Dockerfile.artifact

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ RUN \
4242
apt-get update && \
4343
gcc="gcc" && \
4444
if xx-info is-cross; then gcc="gcc-$(xx-info triple)"; fi; \
45-
apt-get install -y "${gcc}" "libglib2.0-dev:${darch}" "libcap-dev:${darch}" "libseccomp-dev:${darch}"
45+
apt-get install -y "${gcc}" "libglib2.0-dev:${darch}" "libcap-dev:${darch}" "libseccomp-dev:${darch}" "libssl-dev:${darch}"
4646
COPY Dockerfile.artifact.d/meson-cross /meson-cross
4747
RUN meson_setup_flags="--default-library=both" ; \
4848
if xx-info is-cross; then meson_setup_flags="${meson_setup_flags} --cross-file=/meson-cross/$(xx-info) -Dprefix=/usr/local/$(xx-info)"; fi ; \

Dockerfile.buildtests

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ARG LIBSLIRP_COMMIT=v4.9.0
22

33
# Alpine
44
FROM alpine:3 AS buildtest-alpine3-static
5-
RUN apk add --no-cache git build-base autoconf automake libtool linux-headers glib-dev glib-static libcap-static libcap-dev libseccomp-dev libseccomp-static git meson
5+
RUN apk add --no-cache git build-base autoconf automake libtool linux-headers glib-dev glib-static libcap-static libcap-dev libseccomp-dev openssl-dev openssl-libs-static libseccomp-static git meson
66
RUN git clone https://gitlab.freedesktop.org/slirp/libslirp.git /libslirp
77
WORKDIR /libslirp
88
ARG LIBSLIRP_COMMIT
@@ -14,7 +14,7 @@ RUN ./autogen.sh && ./configure LDFLAGS="-static" && make && cp -f slirp4netns /
1414
# Ubuntu
1515
FROM ubuntu:18.04 AS buildtest-ubuntu1804-common
1616
ENV DEBIAN_FRONTEND=noninteractive
17-
RUN apt update && apt install -y automake autotools-dev make gcc libglib2.0-dev libcap-dev libseccomp-dev git ninja-build python3-pip
17+
RUN apt update && apt install -y automake autotools-dev make gcc libglib2.0-dev libcap-dev libseccomp-dev libssl-dev git ninja-build python3-pip
1818
RUN pip3 install meson
1919
RUN git clone https://gitlab.freedesktop.org/slirp/libslirp.git /libslirp
2020
WORKDIR /libslirp
@@ -31,7 +31,7 @@ RUN ./configure && make && cp -f slirp4netns /
3131

3232
# openSUSE (dynamic only)
3333
FROM opensuse/leap:15 AS buildtest-opensuse15-common
34-
RUN zypper install -y --no-recommends autoconf automake gcc glib2-devel git make libcap-devel libseccomp-devel ninja python3-pip
34+
RUN zypper install -y --no-recommends autoconf automake gcc glib2-devel git make libcap-devel libseccomp-devel libopenssl-devel ninja python3-pip
3535
RUN pip3 install meson
3636
RUN git clone https://gitlab.freedesktop.org/slirp/libslirp.git /libslirp
3737
WORKDIR /libslirp

Dockerfile.tests

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ARG LIBSLIRP_COMMIT=v4.9.0
22

33
FROM ubuntu:24.04 AS build
44
ENV DEBIAN_FRONTEND=noninteractive
5-
RUN apt update && apt install -y automake autotools-dev make gcc libglib2.0-dev libcap-dev libseccomp-dev git ninja-build meson
5+
RUN apt update && apt install -y automake autotools-dev make gcc libglib2.0-dev libcap-dev libseccomp-dev libssl-dev git ninja-build meson socat
66
RUN git clone https://gitlab.freedesktop.org/slirp/libslirp.git /libslirp
77
WORKDIR /libslirp
88
ARG LIBSLIRP_COMMIT

Makefile.am

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ noinst_LIBRARIES = libparson.a
77
AM_TESTS_ENVIRONMENT = PATH="$(abs_top_builddir):$(PATH)"
88
TESTS = tests/test-slirp4netns-api-socket.sh \
99
tests/test-slirp4netns-cidr.sh \
10+
tests/test-slirp4netns-cidr6.sh \
1011
tests/test-slirp4netns-configure.sh \
1112
tests/test-slirp4netns-dhcp.sh \
1213
tests/test-slirp4netns-disable-dns.sh \
1314
tests/test-slirp4netns-disable-host-loopback.sh \
1415
tests/test-slirp4netns-exit-fd.sh \
16+
tests/test-slirp4netns-hostfwd.sh \
17+
tests/test-slirp4netns-hostfwd4.sh \
18+
tests/test-slirp4netns-hostfwd6.sh \
19+
tests/test-slirp4netns-ipv6.sh \
1520
tests/test-slirp4netns-macaddress.sh \
1621
tests/test-slirp4netns-nspath.sh \
1722
tests/test-slirp4netns-outbound-addr.sh \
@@ -47,7 +52,7 @@ libparson_a_CFLAGS = $(AM_CFLAGS) -I$(abs_top_builddir)/vendor/parson
4752
libparson_a_SOURCES = vendor/parson/parson.c
4853

4954
slirp4netns_SOURCES = main.c slirp4netns.c api.c sandbox.c seccompfilter.c
50-
slirp4netns_LDADD = libparson.a @GLIB_LIBS@ @SLIRP_LIBS@ @LIBSECCOMP_LIBS@ -lpthread
55+
slirp4netns_LDADD = libparson.a @GLIB_LIBS@ @SLIRP_LIBS@ @LIBSECCOMP_LIBS@ -lpthread -lcrypto
5156
man1_MANS = slirp4netns.1
5257

5358
generate-man:

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# slirp4netns: User-mode networking for unprivileged network namespaces
1+
# slirp4netns: User-mode networking for unprivileged network namespaces
22

33
slirp4netns provides user-mode networking ("slirp") for unprivileged network namespaces.
44

@@ -97,7 +97,7 @@ Also available as a package on almost all Linux distributions:
9797
* [Arch Linux](https://www.archlinux.org/packages/community/x86_64/slirp4netns/)
9898
* [openSUSE (since Leap 15.0)](https://build.opensuse.org/package/show/openSUSE%3AFactory/slirp4netns)
9999
* [SUSE Linux Enterprise (since 15)](https://build.opensuse.org/package/show/devel%3Akubic/slirp4netns)
100-
* [Debian GNU/Linux (since 10.0)](https://packages.debian.org/buster/slirp4netns)
100+
* [Debian GNU/Linux (since 10.0)](https://packages.debian.org/buster/slirp4netns)
101101
* [Ubuntu (since 19.04)](https://packages.ubuntu.com/search?keywords=slirp4netns)
102102
* [NixOS](https://github.com/NixOS/nixpkgs/tree/master/pkgs/tools/networking/slirp4netns)
103103
* [Gentoo Linux](https://packages.gentoo.org/packages/app-emulation/slirp4netns)
@@ -150,7 +150,7 @@ starting slirp, MTU=65520
150150
link/ether c2:28:0c:0e:29:06 brd ff:ff:ff:ff:ff:ff
151151
inet 10.0.2.100/24 brd 10.0.2.255 scope global tap0
152152
valid_lft forever preferred_lft forever
153-
inet6 fe80::c028:cff:fe0e:2906/64 scope link
153+
inet6 fe80::c028:cff:fe0e:2906/64 scope link
154154
valid_lft forever preferred_lft forever
155155
(namespace)$ echo "nameserver 10.0.2.3" > /tmp/resolv.conf
156156
(namespace)$ mount --bind /tmp/resolv.conf /etc/resolv.conf
@@ -193,13 +193,13 @@ The latest revision of slirp4netns is regularly benchmarked (`make benchmark`) o
193193
Build dependencies (`apt-get`):
194194

195195
```console
196-
$ sudo apt-get install libglib2.0-dev libslirp-dev libcap-dev libseccomp-dev
196+
$ sudo apt-get install libglib2.0-dev libslirp-dev libcap-dev libseccomp-dev libssl-dev
197197
```
198198

199199
Build dependencies (`dnf`):
200200

201201
```console
202-
$ sudo dnf install glib2-devel libslirp-devel libcap-devel libseccomp-devel
202+
$ sudo dnf install glib2-devel libslirp-devel libcap-devel libseccomp-devel openssl-devel
203203
```
204204

205205
Installation steps:
@@ -211,7 +211,7 @@ $ make
211211
$ sudo make install
212212
```
213213

214-
* [libslirp](https://gitlab.freedesktop.org/slirp/libslirp) needs to be v4.1.0 or later.
214+
* [libslirp](https://gitlab.freedesktop.org/slirp/libslirp) needs to be v4.1.0 or later. Using v4.5.0 or later is recommended.
215215
* To build `slirp4netns` as a static binary, run `./configure` with `LDFLAGS=-static`.
216216
* If you set `--prefix` to `$HOME`, you don't need to run `make install` with `sudo`.
217217

0 commit comments

Comments
 (0)