aboutsummaryrefslogtreecommitdiff
path: root/src/testing/netjail_core.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/netjail_core.sh')
-rwxr-xr-xsrc/testing/netjail_core.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/testing/netjail_core.sh b/src/testing/netjail_core.sh
index f49d4b312..cf350d3fa 100755
--- a/src/testing/netjail_core.sh
+++ b/src/testing/netjail_core.sh
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3 3
4JAILOR=${SUDO_USER:?must run in sudo} 4
5 5
6# running with `sudo` is required to be 6# running with `sudo` is required to be
7# able running the actual commands as the 7# able running the actual commands as the
@@ -90,6 +90,7 @@ netjail_node_add_default() {
90} 90}
91 91
92netjail_node_exec() { 92netjail_node_exec() {
93 JAILOR=${SUDO_USER:?must run in sudo}
93 NODE=$1 94 NODE=$1
94 FD_IN=$2 95 FD_IN=$2
95 FD_OUT=$3 96 FD_OUT=$3
@@ -99,9 +100,17 @@ netjail_node_exec() {
99} 100}
100 101
101netjail_node_exec_without_fds() { 102netjail_node_exec_without_fds() {
103 JAILOR=${SUDO_USER:?must run in sudo}
102 NODE=$1 104 NODE=$1
103 shift 1 105 shift 1
104 106
105 ip netns exec $NODE sudo -u $JAILOR -- $@ 107 ip netns exec $NODE sudo -u $JAILOR -- $@
106} 108}
107 109
110netjail_node_exec_without_fds_and_sudo() {
111 NODE=$1
112 shift 1
113
114 ip netns exec $NODE $@
115}
116