Skip to contentSkip to conversation

selftests: netfilter: Run nft_audit.sh in its own netns

PATCH New Phil Sutter 1 participant 1 message Oct 13, 2023

Subsystems (2)
lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 selftests: netfilter: Run nft_audit.sh in its own netns

Don't mess with the host's firewall ruleset. Since audit logging is not per-netns, add an initial delay of a second so other selftests' netns cleanups have a chance to finish.

Fixes e8dbde59ca3fe ("selftests: netfilter: Test nf_tables audit logging")
---
 tools/testing/selftests/netfilter/nft_audit.sh | 6 ++++++
 1 file changed, 6 insertions(+)
tools/testing/selftests/netfilter/nft_audit.sh +6 -0
index e94a80859bbdb..99ed5bd6e8402 100755
@@ -11,6 +11,12 @@ nft --version >/dev/null 2>&1 || {
 	exit $SKIP_RC
 }
 
+# Run everything in a separate network namespace
+[ "${1}" != "run" ] && { unshare -n "${0}" run; exit $?; }
+
+# give other scripts a chance to finish - audit_logread sees all activity
+sleep 1
+
 logfile=$(mktemp)
 rulefile=$(mktemp)
 echo "logging into $logfile"
Signature · 1 line
2.41.0