]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/bpf/test_xdp_redirect_multi: use temp netns for testing
authorHangbin Liu <liuhangbin@gmail.com>
Tue, 25 Jan 2022 08:17:11 +0000 (16:17 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:05:59 +0000 (14:05 +0200)
commit3161dd44d4b93bef22a64951f90e47f8e57a7af1
tree11e5d14f5616ba1c7049b451bd1aaa7f2cd4f214
parentf18a459c31dc6c3d8b468b6b17a51eeb8f5df3a4
selftests/bpf/test_xdp_redirect_multi: use temp netns for testing

[ Upstream commit cec74489a8dee93053340ec88ea938ff4008c3c0 ]

Use temp netns instead of hard code name for testing in case the netns
already exists.

Remove the hard code interface index when creating the veth interfaces.
Because when the system loads some virtual interface modules, e.g. tunnels.
the ifindex of 2 will be used and the cmd will fail.

As the netns has not created if checking environment failed. Trap the
clean up function after checking env.

Fixes: 8955c1a32987 ("selftests/bpf/xdp_redirect_multi: Limit the tests in netns")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: William Tu <u9012063@gmail.com>
Link: https://lore.kernel.org/r/20220125081717.1260849-2-liuhangbin@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/bpf/test_xdp_redirect_multi.sh