]> git.baikalelectronics.ru Git - kernel.git/commit
selftests: bpf: Fix bind on used port
authorFelix Maurer <fmaurer@redhat.com>
Tue, 18 Jan 2022 15:11:56 +0000 (16:11 +0100)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 20 Jan 2022 22:32:00 +0000 (14:32 -0800)
commit41a402af0e2f4edf7f43148534a0e0ead92902b4
tree3e02f97c981f4297929a2a7ae5ed779cb1cc5b1e
parent950a50df5d081a51329aa8a2163c190d2109876c
selftests: bpf: Fix bind on used port

The bind_perm BPF selftest failed when port 111/tcp was already in use
during the test. To fix this, the test now runs in its own network name
space.

To use unshare, it is necessary to reorder the includes. The style of
the includes is adapted to be consistent with the other prog_tests.

v2: Replace deprecated CHECK macro with ASSERT_OK

Fixes: dd9739e717888 ("selftests/bpf: Verify that rebinding to port < 1024 from BPF works")
Signed-off-by: Felix Maurer <fmaurer@redhat.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
Link: https://lore.kernel.org/bpf/551ee65533bb987a43f93d88eaf2368b416ccd32.1642518457.git.fmaurer@redhat.com
tools/testing/selftests/bpf/prog_tests/bind_perm.c