[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220510115604.8717-7-magnus.karlsson@gmail.com>
Date: Tue, 10 May 2022 13:56:01 +0200
From: Magnus Karlsson <magnus.karlsson@...il.com>
To: magnus.karlsson@...el.com, bjorn@...nel.org, ast@...nel.org,
daniel@...earbox.net, netdev@...r.kernel.org,
maciej.fijalkowski@...el.com, yhs@...com, andrii@...nel.org,
kafai@...com, songliubraving@...com, john.fastabend@...il.com,
kpsingh@...nel.org
Cc: jonathan.lemon@...il.com, bpf@...r.kernel.org
Subject: [PATCH bpf-next 6/9] selftests: xsk: cleanup veth pair at ctrl-c
From: Magnus Karlsson <magnus.karlsson@...el.com>
Remove the veth pair when the tests are aborted by pressing
ctrl-c. Currently in this situation, the veth pair is left on the
system polluting the netdev space.
Signed-off-by: Magnus Karlsson <magnus.karlsson@...el.com>
---
tools/testing/selftests/bpf/test_xsk.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/bpf/test_xsk.sh b/tools/testing/selftests/bpf/test_xsk.sh
index d06215ee843d..567500299231 100755
--- a/tools/testing/selftests/bpf/test_xsk.sh
+++ b/tools/testing/selftests/bpf/test_xsk.sh
@@ -97,6 +97,13 @@ NS0=root
NS1=af_xdp${VETH1_POSTFIX}
MTU=1500
+trap ctrl_c INT
+
+function ctrl_c() {
+ cleanup_exit ${VETH0} ${VETH1} ${NS1}
+ exit 1
+}
+
setup_vethPairs() {
if [[ $verbose -eq 1 ]]; then
echo "setting up ${VETH0}: namespace: ${NS0}"
--
2.34.1
Powered by blists - more mailing lists