[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250926212929.1469257-3-kuniyu@google.com>
Date: Fri, 26 Sep 2025 21:28:56 +0000
From: Kuniyuki Iwashima <kuniyu@...gle.com>
To: "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
Cc: Simon Horman <horms@...nel.org>, Kuniyuki Iwashima <kuniyu@...gle.com>,
Kuniyuki Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org
Subject: [PATCH v1 net-next 02/12] selftest: packetdrill: Define common TCP
Fast Open cookie.
TCP Fast Open cookie is generated in __tcp_fastopen_cookie_gen_cipher().
The cookie value is generated from src/dst IPs and a key configured by
setsockopt(TCP_FASTOPEN_KEY) or net.ipv4.tcp_fastopen_key.
The default.sh sets net.ipv4.tcp_fastopen_key, and the original packetdrill
defines the corresponding cookie as TFO_COOKIE in run_all.py. [0]
Then, each test does not need to care about the value, and we can easily
update TFO_COOKIE in case __tcp_fastopen_cookie_gen_cipher() changes the
algorithm.
However, some tests use the bare hex value for specific IPv4 addresses
and do not support IPv6.
Let's define the same TFO_COOKIE in ksft_runner.sh.
We will replace such bare hex values with TFO_COOKIE except for a single
test for setsockopt(TCP_FASTOPEN_KEY).
While at it, misalignment in ksft_runner.sh is fixed up.
Signed-off-by: Kuniyuki Iwashima <kuniyu@...gle.com>
---
tools/testing/selftests/net/packetdrill/defaults.sh | 1 +
tools/testing/selftests/net/packetdrill/ksft_runner.sh | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/packetdrill/defaults.sh b/tools/testing/selftests/net/packetdrill/defaults.sh
index 6b0ca8e738a2..b9d4c7d74577 100755
--- a/tools/testing/selftests/net/packetdrill/defaults.sh
+++ b/tools/testing/selftests/net/packetdrill/defaults.sh
@@ -51,6 +51,7 @@ sysctl -q net.ipv4.tcp_pacing_ss_ratio=200
sysctl -q net.ipv4.tcp_pacing_ca_ratio=120
sysctl -q net.ipv4.tcp_notsent_lowat=4294967295 > /dev/null 2>&1
+# Use TFO_COOKIE in ksft_runner.sh for this key.
sysctl -q net.ipv4.tcp_fastopen=0x2
sysctl -q net.ipv4.tcp_fastopen_key=a1a1a1a1-b2b2b2b2-c3c3c3c3-d4d4d4d4
diff --git a/tools/testing/selftests/net/packetdrill/ksft_runner.sh b/tools/testing/selftests/net/packetdrill/ksft_runner.sh
index 0ae6eeeb1a8e..04ba8fecbedb 100755
--- a/tools/testing/selftests/net/packetdrill/ksft_runner.sh
+++ b/tools/testing/selftests/net/packetdrill/ksft_runner.sh
@@ -9,6 +9,7 @@ declare -A ip_args=(
--gateway_ip=192.168.0.1
--netmask_ip=255.255.0.0
--remote_ip=192.0.2.1
+ -D TFO_COOKIE=3021b9d889017eeb
-D CMSG_LEVEL_IP=SOL_IP
-D CMSG_TYPE_RECVERR=IP_RECVERR"
[ipv6]="--ip_version=ipv6
@@ -16,6 +17,7 @@ declare -A ip_args=(
--local_ip=fd3d:0a0b:17d6::1
--gateway_ip=fd3d:0a0b:17d6:8888::1
--remote_ip=fd3d:fa7b:d17d::1
+ -D TFO_COOKIE=c1d1e9742a47a9bc
-D CMSG_LEVEL_IP=SOL_IPV6
-D CMSG_TYPE_RECVERR=IPV6_RECVERR"
)
@@ -52,7 +54,7 @@ ktap_set_plan 2
for ip_version in $ip_versions; do
unshare -n packetdrill ${ip_args[$ip_version]} ${optargs[@]} $script > /dev/null \
- && ktap_test_pass $ip_version || $failfunc $ip_version
+ && ktap_test_pass $ip_version || $failfunc $ip_version
done
ktap_finished
--
2.51.0.536.g15c5d4f767-goog
Powered by blists - more mailing lists