From bec6d3e084cdefff6ab8e86e9ae3f3f77b301ff0 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Wed, 2 Mar 2022 05:00:21 +0100 Subject: test/lib/setup: Unshare PID namespace in pasta_setup() ...otherwise, we'll leave processes (dhclient) around. Signed-off-by: Stefano Brivio --- test/lib/setup | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/lib/setup b/test/lib/setup index b076eff..f04949e 100755 --- a/test/lib/setup +++ b/test/lib/setup @@ -69,12 +69,16 @@ setup_pasta() { layout_pasta - pane_run NS "unshare -rUn /bin/sh " + pane_run NS 'echo $$' pane_wait NS + __tty_pid="$(pane_parse NS)" - pane_run NS 'echo $$' + pane_run NS "unshare -rUnpf /bin/sh" pane_wait NS - __pasta_pid="$(pane_parse NS)" + + pane_run PASST "pstree -p ${__tty_pid} | sed -n 's/.*(\([0-9].*\))$/\1/p'" + pane_wait PASST + __target_pid="$(pane_parse PASST)" # Ports: # @@ -87,7 +91,7 @@ setup_pasta() { [ ${PCAP} -eq 1 ] && __opts="${__opts} -p /tmp/pasta.pcap" [ ${DEBUG} -eq 1 ] && __opts="${__opts} -d" - pane_run PASST "./pasta ${__opts} -f -t 10002 -T 10003 -u 10002 -U 10003 ${__pasta_pid}" + pane_run PASST "./pasta ${__opts} -f -t 10002 -T 10003 -u 10002 -U 10003 ${__target_pid}" sleep 1 } -- cgit v1.2.3