aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/hourly.py3
-rwxr-xr-xsrc/vpn_wrapper.sh8
2 files changed, 7 insertions, 4 deletions
diff --git a/src/hourly.py b/src/hourly.py
index 7af7fd9..1bd01b7 100755
--- a/src/hourly.py
+++ b/src/hourly.py
@@ -213,8 +213,9 @@ def do_hourly_work(hour, logfile):
command_in_namespace = [perform_queries, hour, str(vpn_id)]
logfile.write("Running connection for vpn {}\n".format(vpn_id))
+ # see into vpn_wrapper.sh for explaination of its arguments
p = subprocess.Popen([wrapper, config_path, physical_ip, veth_addr1,
- veth_addr2, route_through_veth] +
+ veth_addr2, route_through_veth, str(vpn_id)] +
command_in_namespace)
pids_wrappers[p.pid] = (vpn_id, subnet, p)
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