Skip to content

Commit

Permalink
testing/test_runner: Always mount new bpffs
Browse files Browse the repository at this point in the history
Since we run in a separate mount namespace, we should always mount a new bpffs
during setup. This way, we are sure the bpffs instance will be removed once we
exit the test run, which ensures that no pinned programs are left at the end of
the test.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
  • Loading branch information
tohojo committed Aug 5, 2024
1 parent 3492ea4 commit 5c7239b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/testing/test_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ check_prereq()
if [ "$max_locked_mem" != "unlimited" ]; then
ulimit -l unlimited || die "Unable to set ulimit"
fi

mount -t bpf bpf /sys/fs/bpf/ || die "Unable to mount bpffs"
}

gen_nsname()
Expand Down Expand Up @@ -294,10 +296,6 @@ init_ns()
OUTSIDE_IP6="${IP6_PREFIX}1"
OUTSIDE_IP4="${IP4_PREFIX}1"

if ! mount | grep -q /sys/fs/bpf; then
mount -t bpf bpf /sys/fs/bpf/
fi

ip netns add "$nsname"
ip link add dev "$nsname" type veth peer name "$peername"
set_sysctls $nsname
Expand Down

0 comments on commit 5c7239b

Please sign in to comment.