summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/net/tcp_fastopen_backup_key.sh
diff options
context:
space:
mode:
authorDavid S. Miller2019-05-30 22:41:26 +0200
committerDavid S. Miller2019-05-30 22:41:26 +0200
commitd48ecb40b5b5a156ae3658dc336bfc29ea502eb6 (patch)
tree0d30a02c064add3df6acf89bfda325e2eff610bf /tools/testing/selftests/net/tcp_fastopen_backup_key.sh
parentMerge branch 'mlxsw-Hardware-monitoring-enhancements' (diff)
parentselftests/net: add TFO key rotation selftest (diff)
downloadkernel-qcow2-linux-d48ecb40b5b5a156ae3658dc336bfc29ea502eb6.tar.gz
kernel-qcow2-linux-d48ecb40b5b5a156ae3658dc336bfc29ea502eb6.tar.xz
kernel-qcow2-linux-d48ecb40b5b5a156ae3658dc336bfc29ea502eb6.zip
Merge branch 'add-TFO-backup-key'
Jason Baron says: ==================== add TFO backup key Christoph, Igor, and I have worked on an API that facilitates TFO key rotation. This is a follow up to the series that Christoph previously posted, with an API that meets both of our use-cases. Here's a link to the previous work: https://patchwork.ozlabs.org/cover/1013753/ Changes in v2: -spelling fixes in ip-sysctl.txt (Jeremy Sowden) -re-base to latest net-next ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/net/tcp_fastopen_backup_key.sh')
-rwxr-xr-xtools/testing/selftests/net/tcp_fastopen_backup_key.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/tcp_fastopen_backup_key.sh b/tools/testing/selftests/net/tcp_fastopen_backup_key.sh
new file mode 100755
index 000000000000..41476399e184
--- /dev/null
+++ b/tools/testing/selftests/net/tcp_fastopen_backup_key.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# rotate TFO keys for ipv4/ipv6 and verify that the client does
+# not present an invalid cookie.
+
+set +x
+set -e
+
+readonly NETNS="ns-$(mktemp -u XXXXXX)"
+
+setup() {
+ ip netns add "${NETNS}"
+ ip -netns "${NETNS}" link set lo up
+ ip netns exec "${NETNS}" sysctl -w net.ipv4.tcp_fastopen=3 \
+ >/dev/null 2>&1
+}
+
+cleanup() {
+ ip netns del "${NETNS}"
+}
+
+trap cleanup EXIT
+setup
+
+do_test() {
+ # flush routes before each run, otherwise successive runs can
+ # initially present an old TFO cookie
+ ip netns exec "${NETNS}" ip tcp_metrics flush
+ ip netns exec "${NETNS}" ./tcp_fastopen_backup_key "$1"
+ val=$(ip netns exec "${NETNS}" nstat -az | \
+ grep TcpExtTCPFastOpenPassiveFail | awk '{print $2}')
+ if [ $val -ne 0 ]; then
+ echo "FAIL: TcpExtTCPFastOpenPassiveFail non-zero"
+ return 1
+ fi
+}
+
+do_test "-4"
+do_test "-6"
+do_test "-4"
+do_test "-6"
+do_test "-4s"
+do_test "-6s"
+do_test "-4s"
+do_test "-6s"
+do_test "-4r"
+do_test "-6r"
+do_test "-4r"
+do_test "-6r"
+do_test "-4sr"
+do_test "-6sr"
+do_test "-4sr"
+do_test "-6sr"
+echo "all tests done"