Skip to content

Commit

Permalink
IPv6: #259 #253
Browse files Browse the repository at this point in the history
- implement forwarding
- implement random CIDR

Signed-off-by: fassl <[email protected]>
  • Loading branch information
pfandl committed Sep 12, 2021
1 parent 631f361 commit 57c3ee9
Show file tree
Hide file tree
Showing 19 changed files with 1,070 additions and 81 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.artifact
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ARG DEBIAN_VERSION=10

FROM --platform=$TARGETPLATFORM debian:${DEBIAN_VERSION} AS build
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y automake autotools-dev make gcc libglib2.0-dev libcap-dev libseccomp-dev git ninja-build python3-pip
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
RUN pip3 install meson
RUN git clone https://gitlab.freedesktop.org/slirp/libslirp.git /libslirp
WORKDIR /libslirp
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.buildtests
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG LIBSLIRP_COMMIT=v4.6.1

# Alpine
FROM alpine:3 AS buildtest-alpine3-static
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
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
RUN git clone https://gitlab.freedesktop.org/slirp/libslirp.git /libslirp
WORKDIR /libslirp
ARG LIBSLIRP_COMMIT
Expand All @@ -14,7 +14,7 @@ RUN ./autogen.sh && ./configure LDFLAGS="-static" && make && cp -f slirp4netns /
# Ubuntu
FROM ubuntu:18.04 AS buildtest-ubuntu1804-common
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y automake autotools-dev make gcc libglib2.0-dev libcap-dev libseccomp-dev git ninja-build python3-pip
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
RUN pip3 install meson
RUN git clone https://gitlab.freedesktop.org/slirp/libslirp.git /libslirp
WORKDIR /libslirp
Expand All @@ -32,7 +32,7 @@ RUN ./configure && make && cp -f slirp4netns /

# openSUSE (dynamic only)
FROM opensuse/leap:15 AS buildtest-opensuse15-common
RUN zypper install -y --no-recommends autoconf automake gcc glib2-devel git make libcap-devel libseccomp-devel ninja python3-pip
RUN zypper install -y --no-recommends autoconf automake gcc glib2-devel git make libcap-devel libseccomp-devel libopenssl-devel ninja python3-pip
RUN pip3 install meson
RUN git clone https://gitlab.freedesktop.org/slirp/libslirp.git /libslirp
WORKDIR /libslirp
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.tests
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG LIBSLIRP_COMMIT=v4.6.1

FROM ubuntu:20.04 AS build
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y automake autotools-dev make gcc libglib2.0-dev libcap-dev libseccomp-dev git ninja-build python3-pip
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 socat
RUN pip3 install meson
RUN git clone https://gitlab.freedesktop.org/slirp/libslirp.git /libslirp
WORKDIR /libslirp
Expand Down
9 changes: 7 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ noinst_LIBRARIES = libparson.a
AM_TESTS_ENVIRONMENT = PATH="$(abs_top_builddir):$(PATH)"
TESTS = tests/test-slirp4netns-api-socket.sh \
tests/test-slirp4netns-cidr.sh \
tests/test-slirp4netns-cidr6.sh \
tests/test-slirp4netns-configure.sh \
tests/test-slirp4netns-dhcp.sh \
tests/test-slirp4netns-disable-dns.sh \
tests/test-slirp4netns-disable-host-loopback.sh \
tests/test-slirp4netns-exit-fd.sh \
tests/test-slirp4netns-hostfwd.sh \
tests/test-slirp4netns-hostfwd4.sh \
tests/test-slirp4netns-hostfwd6.sh \
tests/test-slirp4netns-ipv6.sh \
tests/test-slirp4netns-macaddress.sh \
tests/test-slirp4netns-nspath.sh \
tests/test-slirp4netns-outbound-addr.sh \
Expand Down Expand Up @@ -47,7 +52,7 @@ libparson_a_CFLAGS = $(AM_CFLAGS) -I$(abs_top_builddir)/vendor/parson
libparson_a_SOURCES = vendor/parson/parson.c

slirp4netns_SOURCES = main.c slirp4netns.c api.c sandbox.c seccompfilter.c
slirp4netns_LDADD = libparson.a @GLIB_LIBS@ @SLIRP_LIBS@ @LIBSECCOMP_LIBS@ -lpthread
slirp4netns_LDADD = libparson.a @GLIB_LIBS@ @SLIRP_LIBS@ @LIBSECCOMP_LIBS@ -lpthread -lcrypto
man1_MANS = slirp4netns.1

generate-man:
Expand Down Expand Up @@ -76,7 +81,7 @@ ci:
git -C "$(abs_srcdir)" diff --exit-code
# TODO: make sure ./vendor is synced with ./vendor.sh
$(MAKE) lint
$(MAKE) -j $(shell nproc) distcheck || ( find . -name test-suite.log | xargs cat; exit 1 )
$(MAKE) distcheck || ( find . -name test-suite.log | xargs cat; exit 1 )
PATH=$(shell pwd):$$PATH $(MAKE) benchmark MTU=1500
PATH=$(shell pwd):$$PATH $(MAKE) benchmark MTU=65520

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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`.

Expand Down
4 changes: 2 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Vagrant.configure("2") do |config|
yum install -y \
autoconf automake make gcc gperf libtool \
git-core meson ninja-build \
glib2-devel libcap-devel \
git-core libtool iproute iputils iperf3 nmap jq
glib2-devel libcap-devel openssl-devel \
git-core libtool iproute iputils iperf3 nmap jq socat
# TODO: install udhcpc (required by test-slirp4netns-dhcp.sh)
Expand Down
Loading

0 comments on commit 57c3ee9

Please sign in to comment.