]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/net: Add env for container based tests
authorDavid Wei <dw@davidwei.uk>
Thu, 15 Jan 2026 08:26:01 +0000 (09:26 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 20 Jan 2026 10:58:50 +0000 (11:58 +0100)
commit6be87fbb27763c2999e1c69bbec1f3a63cf05422
tree989d6a2237d0c306fbb9a21561b66bb29d8412ec
parent61d99ce3dfc2f1ba5bf713093bb3a5faf5ebc2dc
selftests/net: Add env for container based tests

Add an env NetDrvContEnv for container based selftests. This automates
the setup of a netns, netkit pair with one inside the netns, and a BPF
program that forwards skbs from the NETIF host inside the container.

Currently only netkit is used, but other virtual netdevs e.g. veth can
be used too.

Expect netkit container datapath selftests to have a publicly routable
IP prefix to assign to netkit in a container, such that packets will
land on eth0. The BPF skb forward program will then forward such packets
from the host netns to the container netns.

Signed-off-by: David Wei <dw@davidwei.uk>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://patch.msgid.link/20260115082603.219152-15-daniel@iogearbox.net
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/drivers/net/README.rst
tools/testing/selftests/drivers/net/hw/lib/py/__init__.py
tools/testing/selftests/drivers/net/lib/py/__init__.py
tools/testing/selftests/drivers/net/lib/py/env.py