aboutsummaryrefslogtreecommitdiff
path: root/src/vpn_wrapper.sh
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-06-16 21:03:10 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-06-16 21:03:10 +0200
commit07f8c9f4f1f62b8fd2e6d281edfdb37da17422cd (patch)
treee5bee67be8cf6c05e3e153f039a2300c3989730f /src/vpn_wrapper.sh
parent5029d161a6b1243b4c1fe80997e7a218b567bcc1 (diff)
download0tdns-07f8c9f4f1f62b8fd2e6d281edfdb37da17422cd.tar.gz
0tdns-07f8c9f4f1f62b8fd2e6d281edfdb37da17422cd.zip
use vpn_id instead of pid for tagging namespaces
Diffstat (limited to 'src/vpn_wrapper.sh')
-rwxr-xr-xsrc/vpn_wrapper.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vpn_wrapper.sh b/src/vpn_wrapper.sh
index 2dbb821..2368839 100755
--- a/src/vpn_wrapper.sh
+++ b/src/vpn_wrapper.sh
@@ -19,15 +19,17 @@ VETH_HOST1="$4"
# caller specifies space-delimited subnets, traffic to which should not be
# routed through the vpn (<database_ip>/32 is going to be here)
ROUTE_THROUGH_VETH="$5"
+# we use a unique id provided in 6th argument to tag namespace name
+ID="$6"
# rest of args is the command to run in network namespace
-for _ in `seq 5`; do
+for _ in `seq 6`; do
shift
done
# to enable multiple instances of this script to run simultaneously,
-# we tag namespace name with this shell's PID
-NAMESPACE_NAME=0tdns$$
+# we tag namespace name
+NAMESPACE_NAME=0tdns$ID
NETNS_SCRIPT=/var/lib/0tdns/netns-script
# in case we want some process in the namespace to be able