]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 27 Apr 2022 09:57:30 +0000 (11:57 +0200)
commitb4672cdef2af81e298a70e9a85b47e8f258137f0
tree745461d3de447181a7d60623a4d389ddadcf2fdb
parenta6d9d1d557c82bd719af9f08378a9cc7aa5b1026
selftests/bpf/test_xdp_redirect_multi: use temp netns for testing

BugLink: https://bugs.launchpad.net/bugs/1969110
[ 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>
(cherry picked from commit c41832e7dadd99c012c3713a5df4dcb801c8be3a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
tools/testing/selftests/bpf/test_xdp_redirect_multi.sh