diff options
author | Reinhard Tartler <siretart@tauware.de> | 2019-01-27 10:42:54 -0500 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2019-01-27 10:42:54 -0500 |
commit | 2495596df437ed78585cb469e63bec16318c3645 (patch) | |
tree | 5ec3c3ec4e2ba87db75171040be59d4fb1fdd996 | |
parent | 271e4fb67c58b50dbddf3049af9a6044132b35d2 (diff) |
New upstream version 0.2.1
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | qemu/slirp/tcp_subr.c | 5 | ||||
-rwxr-xr-x | tests/common.sh | 21 | ||||
-rwxr-xr-x | tests/test-slirp4netns-ready-fd.sh | 2 |
6 files changed, 36 insertions, 12 deletions
diff --git a/Makefile.am b/Makefile.am index 6a9fd7d..a5c5d3d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -67,7 +67,7 @@ libqemu_slirp_a_SOURCES = \ libslirp_a_SOURCES = rd235_libslirp/src/qemu2libslirp.c # define specific commit if git available or it was replaced during git-archive creation -COMMIT := $(shell V=5e4789b9a21cab3315801e1750670e10a1c86a2a ; \ +COMMIT := $(shell V=1797e46728440e93f9229d5a34874befe00b4cab ; \ expr match "$$V" ormat: >/dev/null \ && (cd "$$abs_srcdir" && [ -d .git ] && git describe --always --abbrev=0 --dirty --exclude=\* || echo unknown) \ || echo "$$V" ) @@ -42,18 +42,18 @@ $ sudo make install $ sudo dnf install slirp4netns ``` -#### [Arch Linux](https://aur.archlinux.org/packages/slirp4netns-git/): +#### [Arch Linux](https://aur.archlinux.org/packages/slirp4netns/): -If you're running Arch Linux you can install `slirp4netns-git` from AUR. When you're using an AUR helper ([yay](https://github.com/Jguer/yay), for example) simply use: +If you're running Arch Linux you can install `slirp4netns` (or [`slirp4netns-git`](https://aur.archlinux.org/packages/slirp4netns-git/)) from AUR. When you're using an AUR helper ([yay](https://github.com/Jguer/yay), for example) simply use: - yay -S slirp4netns-git + yay -S slirp4netns Otherwise make sure you have [base-devel](https://www.archlinux.org/groups/x86_64/base-devel/) installed and build a package manually: cd $(mktemp -d) - curl -Lo PKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=slirp4netns-git" + curl -Lo PKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=slirp4netns" makepkg - sudo pacman -U slirp4netns-git-*.pkg.tar.* + sudo pacman -U slirp4netns-*.pkg.tar.* #### [openSUSE Tumbleweed](https://build.opensuse.org/package/show/openSUSE%3AFactory/slirp4netns) @@ -75,6 +75,12 @@ $ sudo zypper addrepo --refresh http://download.opensuse.org/repositories/devel: $ sudo zypper install slirp4netns ``` +#### [Debian GNU/Linux Sid](https://packages.debian.org/sid/slirp4netns) + +```console +$ sudo apt install slirp4netns +``` + ### Usage Terminal 1: Create user/network/mount namespaces diff --git a/configure.ac b/configure.ac index fe6fe99..d76e1b4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.69]) -AC_INIT([slirp4netns], [0.1], [https://github.com/rootless-containers/slirp4netns/issues]) +AC_INIT([slirp4netns], [0.2.1], [https://github.com/rootless-containers/slirp4netns/issues]) AC_CONFIG_SRCDIR([main.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/qemu/slirp/tcp_subr.c b/qemu/slirp/tcp_subr.c index 19d6413..e2605de 100644 --- a/qemu/slirp/tcp_subr.c +++ b/qemu/slirp/tcp_subr.c @@ -640,6 +640,11 @@ tcp_emu(struct socket *so, struct mbuf *m) socklen_t addrlen = sizeof(struct sockaddr_in); struct sbuf *so_rcv = &so->so_rcv; + if (m->m_len > so_rcv->sb_datalen + - (so_rcv->sb_wptr - so_rcv->sb_data)) { + return 1; + } + memcpy(so_rcv->sb_wptr, m->m_data, m->m_len); so_rcv->sb_wptr += m->m_len; so_rcv->sb_rptr += m->m_len; diff --git a/tests/common.sh b/tests/common.sh index 4337c9c..5bf9875 100755 --- a/tests/common.sh +++ b/tests/common.sh @@ -3,7 +3,7 @@ function wait_for_network_namespace { # Wait that the namespace is ready. COUNTER=0 - while [ $COUNTER -lt 10 ]; do + while [ $COUNTER -lt 40 ]; do if nsenter --preserve-credentials -U -n --target=$1 true; then break else @@ -16,7 +16,7 @@ function wait_for_network_namespace { function wait_for_network_device { # Wait that the device appears. COUNTER=0 - while [ $COUNTER -lt 20 ]; do + while [ $COUNTER -lt 40 ]; do if nsenter --preserve-credentials -U -n --target=$1 ip addr show $2; then break else @@ -28,7 +28,7 @@ function wait_for_network_device { function wait_process_exits { COUNTER=0 - while [ $COUNTER -lt 20 ]; do + while [ $COUNTER -lt 40 ]; do if kill -0 $1; then sleep 0.5 else @@ -40,7 +40,7 @@ function wait_process_exits { function wait_for_ping_connectivity { COUNTER=0 - while [ $COUNTER -lt 20 ]; do + while [ $COUNTER -lt 40 ]; do if nsenter --preserve-credentials -U -n --target=$1 ping -c 1 -w 1 $2; then break else @@ -49,3 +49,16 @@ function wait_for_ping_connectivity { let COUNTER=COUNTER+1 done } + +function wait_for_file_content { + # Wait for a file to get the specified content. + COUNTER=0 + while [ $COUNTER -lt 20 ]; do + if grep $1 $2; then + break + else + sleep 0.5 + fi + let COUNTER=COUNTER+1 + done +} diff --git a/tests/test-slirp4netns-ready-fd.sh b/tests/test-slirp4netns-ready-fd.sh index 35775fd..70517cd 100755 --- a/tests/test-slirp4netns-ready-fd.sh +++ b/tests/test-slirp4netns-ready-fd.sh @@ -22,6 +22,6 @@ trap cleanup EXIT wait_for_network_device $child tun11 -grep 1 configured +wait_for_file_content 1 configured exit 0 |