testing/selftests: add test tool and scripts for ovpn module
authorAntonio Quartulli <antonio@openvpn.net>
Tue, 15 Apr 2025 11:17:40 +0000 (13:17 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 17 Apr 2025 10:30:04 +0000 (12:30 +0200)
commit959bc330a4396c4c52e790e62e23141967b39ef9
treeef196fb001d70f898e63a24ed27067465768408a
parentb756861e6e63b0ddadb06bb9f6c87d06ab29bc6f
testing/selftests: add test tool and scripts for ovpn module

The ovpn-cli tool can be compiled and used as selftest for the ovpn
kernel module.

[NOTE: it depends on libmedtls for decoding base64-encoded keys]

ovpn-cli implements the netlink and RTNL APIs and can thus be integrated
in any script for more automated testing.

Along with the tool, a bunch of scripts are provided that perform basic
functionality tests by means of network namespaces.
These scripts take part to the kselftest automation.

The output of the scripts, which will appear in the kselftest
reports, is a list of steps performed by the scripts plus some
output coming from the execution of `ping`, `iperf` and `ovpn-cli`
itself.
In general it is useful only in case of failure, in order to
understand which step has failed and why.

Please note: since peer sockets are tied to the userspace
process that created them (i.e. exiting the process will result
in closing the socket), every run of ovpn-cli that created
one will go to background and enter pause(), waiting for the
signal which will allow it to terminate.
Termination is accomplished at the end of each script by
issuing a killall command.

Cc: linux-kselftest@vger.kernel.org
Cc: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
Link: https://patch.msgid.link/20250415-b4-ovpn-v26-23-577f6097b964@openvpn.net
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
16 files changed:
MAINTAINERS
tools/testing/selftests/Makefile
tools/testing/selftests/net/ovpn/.gitignore [new file with mode: 0644]
tools/testing/selftests/net/ovpn/Makefile [new file with mode: 0644]
tools/testing/selftests/net/ovpn/common.sh [new file with mode: 0644]
tools/testing/selftests/net/ovpn/config [new file with mode: 0644]
tools/testing/selftests/net/ovpn/data64.key [new file with mode: 0644]
tools/testing/selftests/net/ovpn/ovpn-cli.c [new file with mode: 0644]
tools/testing/selftests/net/ovpn/tcp_peers.txt [new file with mode: 0644]
tools/testing/selftests/net/ovpn/test-chachapoly.sh [new file with mode: 0755]
tools/testing/selftests/net/ovpn/test-close-socket-tcp.sh [new file with mode: 0755]
tools/testing/selftests/net/ovpn/test-close-socket.sh [new file with mode: 0755]
tools/testing/selftests/net/ovpn/test-float.sh [new file with mode: 0755]
tools/testing/selftests/net/ovpn/test-tcp.sh [new file with mode: 0755]
tools/testing/selftests/net/ovpn/test.sh [new file with mode: 0755]
tools/testing/selftests/net/ovpn/udp_peers.txt [new file with mode: 0644]