]> git.baikalelectronics.ru Git - kernel.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)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 28 Jan 2022 03:21:27 +0000 (19:21 -0800)
commitc90ebadc07bf9ab280ffcc73f01c7ea0724833fe
tree7234c63aeda6dcc236b6733863ddc87a027e4847
parent0cf2e60a18d11f9bae1940f2abe6e75379bcdc5a
selftests/bpf/test_xdp_redirect_multi: use temp netns for testing

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: 4cce11f11d7f ("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>
tools/testing/selftests/bpf/test_xdp_redirect_multi.sh