]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
selftest: packetdrill: Define common TCP Fast Open cookie.
authorKuniyuki Iwashima <kuniyu@google.com>
Sat, 27 Sep 2025 21:29:41 +0000 (21:29 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 30 Sep 2025 01:41:19 +0000 (18:41 -0700)
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).

Link: https://github.com/google/packetdrill/blob/7230b3990f94/gtests/net/packetdrill/run_all.py#L65
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250927213022.1850048-4-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/packetdrill/defaults.sh
tools/testing/selftests/net/packetdrill/ksft_runner.sh

index 34fcafefa344141cbfebae8d19f428c1a625cecc..37edd3dc3b0767fcd6d79b2bded63d2045d97948 100755 (executable)
@@ -52,6 +52,7 @@ sysctl -q net.ipv4.tcp_pacing_ca_ratio=120
 sysctl -q net.ipv4.tcp_notsent_lowat=4294967295 > /dev/null 2>&1
 
 sysctl -q net.ipv4.tcp_fastopen=0x3
+# Use TFO_COOKIE in ksft_runner.sh for this key.
 sysctl -q net.ipv4.tcp_fastopen_key=a1a1a1a1-b2b2b2b2-c3c3c3c3-d4d4d4d4
 
 sysctl -q net.ipv4.tcp_syncookies=1
index 3fa7c7f66caf4e4b5ded27c4744649f2b21ee59b..cc672bf5f58a04b2ac0aa7548e1a474e53d7bcbd 100755 (executable)
@@ -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"
 )