The TCP timestamp option verifier checks TSval with a timing tolerance but
does not compare TSecr. A script can therefore pass when the kernel echoes
a different timestamp. For example, a Linux receiver test expecting an
echo of 301000 accepts an actual echo of 1000.
Compare the current option's TSecr fields exactly, using check_field() to
report the expected and actual values. Keep the existing TSval tolerance
and option-wildcard behavior. This restores the echo check lost when the
TCP option verifier switched from a bytewise comparison to per-option
validation.
Tested on Linux/arm64 with GCC and Clang. Verified that the old tool
accepts the incorrect echo and the fixed tool rejects it; both tools
pass the same receiver test with the Linux fix applied.
Fixes: 9a0ade62b7c8 ("net-test: packetdrill: merge Google packetdrill changes through April 2018")
Suggested-by: Eric Dumazet <
edum...@google.com>
Link:
https://lore.kernel.org/netdev/CANn89iK00zXGA8sdpH9Y1CkFK3n%3DuKG9Bci3%2B%3D69fGV0UDQ80w%40mail.gmail.com/
Assisted-by: LLM
Signed-off-by: Jeff Jo <
jef...@openai.com>
---
gtests/net/packetdrill/run_packet.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gtests/net/packetdrill/run_packet.c b/gtests/net/packetdrill/run_packet.c
index 8ad8443..b7f8848 100644
--- a/gtests/net/packetdrill/run_packet.c
+++ b/gtests/net/packetdrill/run_packet.c
@@ -1374,6 +1374,10 @@ static int verify_outbound_tcp_option(
asprintf(error, "bad outbound TCP timestamp value, tolerance %ld", tolerance_usecs);
return STATUS_ERR;
}
+ if (check_field("tcp_ts_ecr",
+ ntohl(script_option->data.time_stamp.ecr),
+ ntohl(actual_option->data.time_stamp.ecr), error))
+ return STATUS_ERR;
break;
default:
--
2.55.0