selftests/bpf/xdp_redirect_multi: Limit the tests in netns
authorHangbin Liu <liuhangbin@gmail.com>
Wed, 27 Oct 2021 03:35:53 +0000 (11:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:17:09 +0000 (19:17 +0100)
commit39db3e5681bd8e3b241c6d54916bbedd8e1e3c7d
tree601e7eab751f763695e29ba3cfd64ac885277b4a
parenta99e4d94df317577c8d27f2134b68594290a4069
selftests/bpf/xdp_redirect_multi: Limit the tests in netns

[ Upstream commit 8955c1a329873385775081e029d9a7c6aa9037e1 ]

As I want to test both DEVMAP and DEVMAP_HASH in XDP multicast redirect, I
limited DEVMAP max entries to a small value for performace. When the test
runs after amount of interface creating/deleting tests. The interface index
will exceed the map max entries and xdp_redirect_multi will error out with
"Get interfacesInterface index to large".

Fix this issue by limit the tests in netns and specify the ifindex when
creating interfaces.

Fixes: d23292476297 ("selftests/bpf: Add xdp_redirect_multi test")
Reported-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20211027033553.962413-5-liuhangbin@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/bpf/test_xdp_redirect_multi.sh
tools/testing/selftests/bpf/xdp_redirect_multi.c