Skip to content

Commit 2e2d9c7

Browse files
Phil SutterFlorian Westphal
authored andcommitted
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: e8dbde5 ("selftests: netfilter: Test nf_tables audit logging") Signed-off-by: Phil Sutter <[email protected]> Signed-off-by: Florian Westphal <[email protected]>
1 parent 1baf015 commit 2e2d9c7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/testing/selftests/netfilter/nft_audit.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ nft --version >/dev/null 2>&1 || {
1111
exit $SKIP_RC
1212
}
1313

14+
# Run everything in a separate network namespace
15+
[ "${1}" != "run" ] && { unshare -n "${0}" run; exit $?; }
16+
17+
# give other scripts a chance to finish - audit_logread sees all activity
18+
sleep 1
19+
1420
logfile=$(mktemp)
1521
rulefile=$(mktemp)
1622
echo "logging into $logfile"

0 commit comments

Comments
 (0)