new file mode 100644
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+include ../lib.mk
+
+TEST_PROGS += ./run.sh
+TEST_FILES := setup.py setup.cfg tcp_authopt_test
new file mode 100644
@@ -0,0 +1,15 @@
+=========================================
+Tests for linux TCP Authentication Option
+=========================================
+
+Test suite is written in python3 using pytest and scapy. The test suite is
+mostly self-contained as a python package.
+
+The recommended way to run this is the included `run.sh` script as root, this
+will automatically create a virtual environment with the correct dependencies
+using `tox`.
+
+An old separate version can be found here: https://github.com/cdleonard/tcp-authopt-test
+
+Integration with kselftest infrastructure is minimal: when in doubt just run
+this separately.
new file mode 100644
@@ -0,0 +1,6 @@
+# RFC5925 TCP Authentication Option and all algorithms
+CONFIG_TCP_AUTHOPT=y
+CONFIG_CRYPTO_SHA1=M
+CONFIG_CRYPTO_HMAC=M
+CONFIG_CRYPTO_AES=M
+CONFIG_CRYPTO_CMAC=M
new file mode 100644
@@ -0,0 +1,40 @@
+#
+# This file is autogenerated by pip-compile with python 3.8
+# To update, run:
+#
+# pip-compile
+#
+argparse==1.4.0
+ # via nsenter
+attrs==21.2.0
+ # via pytest
+cffi==1.14.6
+ # via cryptography
+contextlib2==21.6.0
+ # via nsenter
+cryptography==3.4.8
+ # via tcp-authopt-test (setup.py)
+iniconfig==1.1.1
+ # via pytest
+nsenter==0.2
+ # via tcp-authopt-test (setup.py)
+packaging==21.0
+ # via pytest
+pathlib==1.0.1
+ # via nsenter
+pluggy==0.13.1
+ # via pytest
+py==1.10.0
+ # via pytest
+pycparser==2.20
+ # via cffi
+pyparsing==2.4.7
+ # via packaging
+pytest==6.2.4
+ # via tcp-authopt-test (setup.py)
+scapy==2.4.5
+ # via tcp-authopt-test (setup.py)
+toml==0.10.2
+ # via pytest
+waiting==1.4.1
+ # via tcp-authopt-test (setup.py)
new file mode 100755
@@ -0,0 +1,15 @@
+#! /bin/bash
+#
+# Create virtualenv using tox and run pytest
+# Accepts all args that pytest does
+#
+
+if ! command -v tox >/dev/null; then
+ echo >&2 "error: please install the python tox package"
+ exit 1
+fi
+if [[ $(id -u) -ne 0 ]]; then
+ echo >&2 "warning: running as non-root user is unlikely to work"
+fi
+cd "$(dirname "${BASH_SOURCE[0]}")"
+exec tox -- -s --log-cli-level=DEBUG "$@"
new file mode 100644
@@ -0,0 +1,17 @@
+[options]
+install_requires=
+ cryptography
+ nsenter
+ pytest
+ scapy
+ waiting
+
+[tox:tox]
+envlist = py3
+
+[testenv]
+commands = pytest {posargs}
+
+[metadata]
+name = tcp-authopt-test
+version = 0.1
new file mode 100644
@@ -0,0 +1,5 @@
+#! /usr/bin/env python3
+
+from setuptools import setup
+
+setup()
new file mode 100644
This test suite is written as a standalone python3 package using dependencies such as scapy. The run.sh script wrapper called from kselftest infrastructure uses "tox" to generate an isolated virtual environment just for running these tests. The run.sh wrapper can be called from anywhere and does not rely on kselftest infrastructure. The python3 and tox packages be installed manually but not any other dependencies Signed-off-by: Leonard Crestez <cdleonard@gmail.com> --- tools/testing/selftests/tcp_authopt/Makefile | 5 +++ .../testing/selftests/tcp_authopt/README.rst | 15 +++++++ tools/testing/selftests/tcp_authopt/config | 6 +++ .../selftests/tcp_authopt/requirements.txt | 40 +++++++++++++++++++ tools/testing/selftests/tcp_authopt/run.sh | 15 +++++++ tools/testing/selftests/tcp_authopt/setup.cfg | 17 ++++++++ tools/testing/selftests/tcp_authopt/setup.py | 5 +++ .../tcp_authopt/tcp_authopt_test/__init__.py | 0 8 files changed, 103 insertions(+) create mode 100644 tools/testing/selftests/tcp_authopt/Makefile create mode 100644 tools/testing/selftests/tcp_authopt/README.rst create mode 100644 tools/testing/selftests/tcp_authopt/config create mode 100644 tools/testing/selftests/tcp_authopt/requirements.txt create mode 100755 tools/testing/selftests/tcp_authopt/run.sh create mode 100644 tools/testing/selftests/tcp_authopt/setup.cfg create mode 100644 tools/testing/selftests/tcp_authopt/setup.py create mode 100644 tools/testing/selftests/tcp_authopt/tcp_authopt_test/__init__.py