-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support slirp configuration v2 and v3
Signed-off-by: Bohumil Cervenka <5eraph@protonmail.com>
- Loading branch information
Showing
9 changed files
with
1,409 additions
and
1,091 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
ARG LIBSLIRP_COMMIT=v4.3.0 | ||
|
||
FROM ubuntu:18.04 AS build | ||
RUN apt update && apt install -y automake autotools-dev make gcc libglib2.0-dev libcap-dev libseccomp-dev git ninja-build python3-pip | ||
RUN pip3 install meson | ||
RUN git clone https://gitlab.freedesktop.org/slirp/libslirp.git /libslirp | ||
WORKDIR /libslirp | ||
ARG LIBSLIRP_COMMIT | ||
RUN git pull && git checkout ${LIBSLIRP_COMMIT} && meson setup build && ninja -C build install | ||
COPY . /slirp4netns | ||
WORKDIR /slirp4netns | ||
RUN chown -R 1000:1000 /slirp4netns | ||
USER 1000:1000 | ||
RUN ./autogen.sh && ./configure && make -j $(nproc) | ||
|
||
FROM build AS test | ||
USER 0 | ||
RUN apt update && apt install -y git libtool iproute2 clang clang-format clang-tidy iputils-ping iperf3 nmap jq | ||
USER 1000:1000 | ||
CMD ["make", "ci"] | ||
ARG LIBSLIRP_COMMIT=v4.3.0 | ||
FROM ubuntu:18.04 AS build | ||
RUN apt update && apt install -y automake autotools-dev make gcc libglib2.0-dev libcap-dev libseccomp-dev git ninja-build python3-pip | ||
RUN pip3 install meson | ||
RUN git clone https://gitlab.freedesktop.org/slirp/libslirp.git /libslirp | ||
WORKDIR /libslirp | ||
ARG LIBSLIRP_COMMIT | ||
RUN git pull && git checkout ${LIBSLIRP_COMMIT} && meson setup build && ninja -C build install | ||
COPY . /slirp4netns | ||
WORKDIR /slirp4netns | ||
RUN chown -R 1000:1000 /slirp4netns | ||
USER 1000:1000 | ||
RUN ./autogen.sh && ./configure && make -j $(nproc) | ||
FROM build AS test | ||
USER 0 | ||
RUN apt update && apt install -y git libtool iproute2 clang clang-format clang-tidy iputils-ping iperf3 nmap jq | ||
USER 1000:1000 | ||
CMD ["make", "ci"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,68 @@ | ||
bin_PROGRAMS = slirp4netns | ||
|
||
AM_CFLAGS = @GLIB_CFLAGS@ @SLIRP_CFLAGS@ @LIBCAP_CFLAGS@ @LIBSECCOMP_CFLAGS@ | ||
|
||
noinst_LIBRARIES = libparson.a | ||
|
||
AM_TESTS_ENVIRONMENT = PATH="$(abs_top_builddir):$(PATH)" | ||
TESTS = tests/test-slirp4netns.sh tests/test-slirp4netns-configure.sh tests/test-slirp4netns-exit-fd.sh tests/test-slirp4netns-ready-fd.sh tests/test-slirp4netns-api-socket.sh tests/test-slirp4netns-disable-host-loopback.sh tests/test-slirp4netns-cidr.sh | ||
|
||
EXTRA_DIST = \ | ||
slirp4netns.1.md \ | ||
slirp4netns.1 \ | ||
$(TESTS) \ | ||
tests/common.sh \ | ||
slirp4netns.h \ | ||
api.h \ | ||
sandbox.h \ | ||
seccompfilter.h \ | ||
tests/slirp4netns-no-unmount.sh \ | ||
vendor/parson/LICENSE \ | ||
vendor/parson/README.md \ | ||
vendor/parson/parson.h | ||
|
||
# define specific commit if git available or it was replaced during git-archive creation | ||
COMMIT := $(shell V=$Format:%H$ ; \ | ||
expr match "$$V" ormat: >/dev/null \ | ||
&& (cd "$$abs_srcdir" && [ -d .git ] && git describe --always --abbrev=0 --dirty --exclude=\* || echo unknown) \ | ||
|| echo "$$V" ) | ||
DEFINE_COMMIT = -DCOMMIT="\"$(COMMIT)\"" | ||
|
||
slirp4netns_CFLAGS = $(AM_CFLAGS) $(DEFINE_COMMIT) | ||
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 | ||
man1_MANS = slirp4netns.1 | ||
|
||
generate-man: | ||
go-md2man -in slirp4netns.1.md -out slirp4netns.1 | ||
|
||
CLANGTIDY = clang-tidy -warnings-as-errors='*' | ||
|
||
CLANGFORMAT = clang-format | ||
|
||
lint: | ||
$(CLANGTIDY) $(slirp4netns_SOURCES) -- $(AM_CFLAGS) | ||
|
||
lint-full: | ||
$(CLANGTIDY) $(slirp4netns_SOURCES) $(libparson_a_SOURCES) -- $(AM_CFLAGS) | ||
|
||
indent: | ||
$(CLANGFORMAT) -i $(slirp4netns_SOURCES) | ||
|
||
benchmark: | ||
benchmarks/benchmark-iperf3.sh | ||
benchmarks/benchmark-iperf3-reverse.sh | ||
|
||
ci: | ||
$(MAKE) indent | ||
git 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 ) | ||
PATH=$(shell pwd):$$PATH $(MAKE) benchmark MTU=1500 | ||
PATH=$(shell pwd):$$PATH $(MAKE) benchmark MTU=65520 | ||
|
||
.PHONY: generate-man lint lint-full indent benchmark ci | ||
bin_PROGRAMS = slirp4netns | ||
|
||
AM_CFLAGS = @GLIB_CFLAGS@ @SLIRP_CFLAGS@ @LIBCAP_CFLAGS@ @LIBSECCOMP_CFLAGS@ | ||
|
||
noinst_LIBRARIES = libparson.a | ||
|
||
AM_TESTS_ENVIRONMENT = PATH="$(abs_top_builddir):$(PATH)" | ||
TESTS = tests/test-slirp4netns.sh tests/test-slirp4netns-configure.sh tests/test-slirp4netns-exit-fd.sh tests/test-slirp4netns-ready-fd.sh tests/test-slirp4netns-api-socket.sh tests/test-slirp4netns-disable-host-loopback.sh tests/test-slirp4netns-cidr.sh tests/test-slirp4netns-outbound-addr.sh tests/test-slirp4netns-disable-dns.sh | ||
|
||
EXTRA_DIST = \ | ||
slirp4netns.1.md \ | ||
slirp4netns.1 \ | ||
$(TESTS) \ | ||
tests/common.sh \ | ||
slirp4netns.h \ | ||
api.h \ | ||
sandbox.h \ | ||
seccompfilter.h \ | ||
tests/slirp4netns-no-unmount.sh \ | ||
vendor/parson/LICENSE \ | ||
vendor/parson/README.md \ | ||
vendor/parson/parson.h | ||
|
||
# define specific commit if git available or it was replaced during git-archive creation | ||
COMMIT := $(shell V=$Format:%H$ ; \ | ||
expr match "$$V" ormat: >/dev/null \ | ||
&& (cd "$$abs_srcdir" && [ -d .git ] && git describe --always --abbrev=0 --dirty --exclude=\* || echo unknown) \ | ||
|| echo "$$V" ) | ||
DEFINE_COMMIT = -DCOMMIT="\"$(COMMIT)\"" | ||
|
||
slirp4netns_CFLAGS = $(AM_CFLAGS) $(DEFINE_COMMIT) | ||
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 | ||
man1_MANS = slirp4netns.1 | ||
|
||
generate-man: | ||
go-md2man -in slirp4netns.1.md -out slirp4netns.1 | ||
|
||
CLANGTIDY = clang-tidy -warnings-as-errors='*' | ||
|
||
CLANGFORMAT = clang-format | ||
|
||
lint: | ||
$(CLANGTIDY) $(slirp4netns_SOURCES) -- $(AM_CFLAGS) | ||
|
||
lint-full: | ||
$(CLANGTIDY) $(slirp4netns_SOURCES) $(libparson_a_SOURCES) -- $(AM_CFLAGS) | ||
|
||
indent: | ||
$(CLANGFORMAT) -i $(slirp4netns_SOURCES) | ||
|
||
benchmark: | ||
benchmarks/benchmark-iperf3.sh | ||
benchmarks/benchmark-iperf3-reverse.sh | ||
|
||
ci: | ||
$(MAKE) indent | ||
git 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 ) | ||
PATH=$(shell pwd):$$PATH $(MAKE) benchmark MTU=1500 | ||
PATH=$(shell pwd):$$PATH $(MAKE) benchmark MTU=65520 | ||
|
||
.PHONY: generate-man lint lint-full indent benchmark ci |
Oops, something went wrong.