Commit 4c2e8c6 1 parent a9c57a9 commit 4c2e8c6 Copy full SHA for 4c2e8c6
File tree 3 files changed +32
-0
lines changed
3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ EXTRA_DIST = \
16
16
api.h \
17
17
sandbox.h \
18
18
seccompfilter.h \
19
+ tests/slirp4netns-no-unmount.sh \
19
20
vendor/libslirp/COPYRIGHT \
20
21
vendor/libslirp/README.md \
21
22
vendor/libslirp/src/bootp.h \
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -xeuo pipefail
3
+
4
+ . $( dirname $0 ) /common.sh
5
+
6
+ # it is a part of test-slirp4netns.sh
7
+ # must run in a new mount namespace
8
+
9
+ mount -t tmpfs tmpfs /run
10
+ mkdir /run/foo
11
+ mount -t tmpfs tmpfs /run/foo
12
+ mount --make-rshared /run
13
+
14
+ unshare -n sleep infinity &
15
+ child=$!
16
+
17
+ wait_for_network_namespace $child
18
+
19
+ ./slirp4netns --enable-sandbox --netns-type=path /proc/$child /ns/net tun11 &
20
+ slirp_pid=$!
21
+
22
+ function cleanup {
23
+ kill -9 $child $slirp_pid
24
+ }
25
+ trap cleanup EXIT
26
+
27
+ wait_for_network_device $child tun11
28
+
29
+ findmnt /run/foo
Original file line number Diff line number Diff line change @@ -67,3 +67,5 @@ wait_for_network_device $child tun11
67
67
68
68
nsenter --preserve-credentials -U -n --target=$child ip -a netconf | grep tun11
69
69
nsenter --preserve-credentials -U -n --target=$child ip addr show tun11 | grep -v inet
70
+
71
+ unshare -rm $( readlink -f $( dirname $0 ) /slirp4netns-no-unmount.sh)
You can’t perform that action at this time.
0 commit comments