* [PATCH net] selftests: forwarding: local_termination: fix PTP UDP cksums
@ 2026-03-21 4:26 Daniel Golle
2026-03-21 12:19 ` Alexander Sverdlin
2026-03-24 2:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Golle @ 2026-03-21 4:26 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, Vladimir Oltean, Daniel Golle,
Alexander Sverdlin, netdev, linux-kselftest, linux-kernel
All six PTP-over-IP test frames (3x IPv4 + 3x IPv6) contain incorrect
UDP checksums. The stored values are the ones-complement sums of just
the pseudo-headers, not the complete UDP checksums over pseudo-header +
UDP header + payload. This is characteristic of frames captured on the
sender before TX checksum offload completion.
For example, the IPv4 Sync and Follow-Up frames both store checksum
0xa3c8 despite having different UDP payloads and port numbers - 0xa3c8
is their shared pseudo-header sum (same src/dst IP, same protocol and
UDP length).
While most L2 switches forward frames without verifying transport
checksums, hardware that performs deep packet inspection or has PTP
awareness may validate UDP checksums and drop frames that fail
verification. This causes the 1588v2 over IPv4/IPv6 tests to fail on
such hardware even though L2 PTP (which has no UDP checksum) passes
fine.
Replace all six pseudo-header partial sums with the correctly computed
full UDP checksums:
IPv4 Sync: 0xa3c8 -> 0x9f41
IPv4 Follow-Up: 0xa3c8 -> 0xeb8a
IPv4 Peer Delay Req: 0xa2bc -> 0x9ab9
IPv6 Sync: 0x2e92 -> 0x1476
IPv6 Follow-Up: 0x2e92 -> 0xf047
IPv6 Peer Delay Req: 0xb454 -> 0x891f
Fixes: 2379795042649 ("selftests: net: local_termination: add PTP frames to the mix")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
.../selftests/net/forwarding/local_termination.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/net/forwarding/local_termination.sh b/tools/testing/selftests/net/forwarding/local_termination.sh
index 9bc9d25e71368..15b1a1255a41f 100755
--- a/tools/testing/selftests/net/forwarding/local_termination.sh
+++ b/tools/testing/selftests/net/forwarding/local_termination.sh
@@ -57,21 +57,21 @@ PTP_1588_L2_PDELAY_REQ=" \
PTP_1588_IPV4_SYNC=" \
01:00:5e:00:01:81 00:00:de:ad:be:ef 08:00 45 00 \
00 48 0a 9a 40 00 01 11 cb 88 c0 00 02 01 e0 00 \
-01 81 01 3f 01 3f 00 34 a3 c8 00 02 00 2c 00 00 \
+01 81 01 3f 01 3f 00 34 9f 41 00 02 00 2c 00 00 \
02 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \
63 ff fe cf 17 0e 00 01 00 00 00 00 00 00 00 00 \
00 00 00 00 00 00"
PTP_1588_IPV4_FOLLOW_UP="
01:00:5e:00:01:81 00:00:de:ad:be:ef 08:00 45 00 \
00 48 0a 9b 40 00 01 11 cb 87 c0 00 02 01 e0 00 \
-01 81 01 40 01 40 00 34 a3 c8 08 02 00 2c 00 00 \
+01 81 01 40 01 40 00 34 eb 8a 08 02 00 2c 00 00 \
00 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \
63 ff fe cf 17 0e 00 01 00 00 02 00 00 00 66 83 \
c6 0f 1d 9a 61 87"
PTP_1588_IPV4_PDELAY_REQ=" \
01:00:5e:00:00:6b 00:00:de:ad:be:ef 08:00 45 00 \
00 52 35 a9 40 00 01 11 a1 85 c0 00 02 01 e0 00 \
-00 6b 01 3f 01 3f 00 3e a2 bc 02 02 00 36 00 00 \
+00 6b 01 3f 01 3f 00 3e 9a b9 02 02 00 36 00 00 \
00 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \
63 ff fe cf 17 0e 00 01 00 01 05 7f 00 00 00 00 \
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
@@ -79,7 +79,7 @@ PTP_1588_IPV6_SYNC=" \
33:33:00:00:01:81 00:00:de:ad:be:ef 86:dd 60 06 \
7c 2f 00 36 11 01 20 01 0d b8 00 01 00 00 00 00 \
00 00 00 00 00 01 ff 0e 00 00 00 00 00 00 00 00 \
-00 00 00 00 01 81 01 3f 01 3f 00 36 2e 92 00 02 \
+00 00 00 00 01 81 01 3f 01 3f 00 36 14 76 00 02 \
00 2c 00 00 02 00 00 00 00 00 00 00 00 00 00 00 \
00 00 3e 37 63 ff fe cf 17 0e 00 01 00 00 00 00 \
00 00 00 00 00 00 00 00 00 00 00 00"
@@ -87,7 +87,7 @@ PTP_1588_IPV6_FOLLOW_UP=" \
33:33:00:00:01:81 00:00:de:ad:be:ef 86:dd 60 0a \
00 bc 00 36 11 01 20 01 0d b8 00 01 00 00 00 00 \
00 00 00 00 00 01 ff 0e 00 00 00 00 00 00 00 00 \
-00 00 00 00 01 81 01 40 01 40 00 36 2e 92 08 02 \
+00 00 00 00 01 81 01 40 01 40 00 36 f0 47 08 02 \
00 2c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
00 00 3e 37 63 ff fe cf 17 0e 00 01 00 00 02 00 \
00 00 66 83 c6 2a 32 09 bd 74 00 00"
@@ -95,7 +95,7 @@ PTP_1588_IPV6_PDELAY_REQ=" \
33:33:00:00:00:6b 00:00:de:ad:be:ef 86:dd 60 0c \
5c fd 00 40 11 01 fe 80 00 00 00 00 00 00 3c 37 \
63 ff fe cf 17 0e ff 02 00 00 00 00 00 00 00 00 \
-00 00 00 00 00 6b 01 3f 01 3f 00 40 b4 54 02 02 \
+00 00 00 00 00 6b 01 3f 01 3f 00 40 89 1f 02 02 \
00 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
00 00 3e 37 63 ff fe cf 17 0e 00 01 00 01 05 7f \
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] selftests: forwarding: local_termination: fix PTP UDP cksums
2026-03-21 4:26 [PATCH net] selftests: forwarding: local_termination: fix PTP UDP cksums Daniel Golle
@ 2026-03-21 12:19 ` Alexander Sverdlin
2026-03-24 2:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Sverdlin @ 2026-03-21 12:19 UTC (permalink / raw)
To: Daniel Golle, netdev, linux-kselftest, linux-kernel
Hi Daniel,
On Sat, 2026-03-21 at 04:26 +0000, Daniel Golle wrote:
> All six PTP-over-IP test frames (3x IPv4 + 3x IPv6) contain incorrect
> UDP checksums. The stored values are the ones-complement sums of just
> the pseudo-headers, not the complete UDP checksums over pseudo-header +
> UDP header + payload. This is characteristic of frames captured on the
> sender before TX checksum offload completion.
>
> For example, the IPv4 Sync and Follow-Up frames both store checksum
> 0xa3c8 despite having different UDP payloads and port numbers - 0xa3c8
> is their shared pseudo-header sum (same src/dst IP, same protocol and
> UDP length).
>
> While most L2 switches forward frames without verifying transport
> checksums, hardware that performs deep packet inspection or has PTP
> awareness may validate UDP checksums and drop frames that fail
> verification. This causes the 1588v2 over IPv4/IPv6 tests to fail on
> such hardware even though L2 PTP (which has no UDP checksum) passes
> fine.
>
> Replace all six pseudo-header partial sums with the correctly computed
> full UDP checksums:
>
> IPv4 Sync: 0xa3c8 -> 0x9f41
> IPv4 Follow-Up: 0xa3c8 -> 0xeb8a
> IPv4 Peer Delay Req: 0xa2bc -> 0x9ab9
> IPv6 Sync: 0x2e92 -> 0x1476
> IPv6 Follow-Up: 0x2e92 -> 0xf047
> IPv6 Peer Delay Req: 0xb454 -> 0x891f
>
> Fixes: 2379795042649 ("selftests: net: local_termination: add PTP frames to the mix")
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
wireshark agrees,
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
> ---
> .../selftests/net/forwarding/local_termination.sh | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/selftests/net/forwarding/local_termination.sh b/tools/testing/selftests/net/forwarding/local_termination.sh
> index 9bc9d25e71368..15b1a1255a41f 100755
> --- a/tools/testing/selftests/net/forwarding/local_termination.sh
> +++ b/tools/testing/selftests/net/forwarding/local_termination.sh
> @@ -57,21 +57,21 @@ PTP_1588_L2_PDELAY_REQ=" \
> PTP_1588_IPV4_SYNC=" \
> 01:00:5e:00:01:81 00:00:de:ad:be:ef 08:00 45 00 \
> 00 48 0a 9a 40 00 01 11 cb 88 c0 00 02 01 e0 00 \
> -01 81 01 3f 01 3f 00 34 a3 c8 00 02 00 2c 00 00 \
> +01 81 01 3f 01 3f 00 34 9f 41 00 02 00 2c 00 00 \
> 02 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \
> 63 ff fe cf 17 0e 00 01 00 00 00 00 00 00 00 00 \
> 00 00 00 00 00 00"
> PTP_1588_IPV4_FOLLOW_UP="
> 01:00:5e:00:01:81 00:00:de:ad:be:ef 08:00 45 00 \
> 00 48 0a 9b 40 00 01 11 cb 87 c0 00 02 01 e0 00 \
> -01 81 01 40 01 40 00 34 a3 c8 08 02 00 2c 00 00 \
> +01 81 01 40 01 40 00 34 eb 8a 08 02 00 2c 00 00 \
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \
> 63 ff fe cf 17 0e 00 01 00 00 02 00 00 00 66 83 \
> c6 0f 1d 9a 61 87"
> PTP_1588_IPV4_PDELAY_REQ=" \
> 01:00:5e:00:00:6b 00:00:de:ad:be:ef 08:00 45 00 \
> 00 52 35 a9 40 00 01 11 a1 85 c0 00 02 01 e0 00 \
> -00 6b 01 3f 01 3f 00 3e a2 bc 02 02 00 36 00 00 \
> +00 6b 01 3f 01 3f 00 3e 9a b9 02 02 00 36 00 00 \
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \
> 63 ff fe cf 17 0e 00 01 00 01 05 7f 00 00 00 00 \
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
> @@ -79,7 +79,7 @@ PTP_1588_IPV6_SYNC=" \
> 33:33:00:00:01:81 00:00:de:ad:be:ef 86:dd 60 06 \
> 7c 2f 00 36 11 01 20 01 0d b8 00 01 00 00 00 00 \
> 00 00 00 00 00 01 ff 0e 00 00 00 00 00 00 00 00 \
> -00 00 00 00 01 81 01 3f 01 3f 00 36 2e 92 00 02 \
> +00 00 00 00 01 81 01 3f 01 3f 00 36 14 76 00 02 \
> 00 2c 00 00 02 00 00 00 00 00 00 00 00 00 00 00 \
> 00 00 3e 37 63 ff fe cf 17 0e 00 01 00 00 00 00 \
> 00 00 00 00 00 00 00 00 00 00 00 00"
> @@ -87,7 +87,7 @@ PTP_1588_IPV6_FOLLOW_UP=" \
> 33:33:00:00:01:81 00:00:de:ad:be:ef 86:dd 60 0a \
> 00 bc 00 36 11 01 20 01 0d b8 00 01 00 00 00 00 \
> 00 00 00 00 00 01 ff 0e 00 00 00 00 00 00 00 00 \
> -00 00 00 00 01 81 01 40 01 40 00 36 2e 92 08 02 \
> +00 00 00 00 01 81 01 40 01 40 00 36 f0 47 08 02 \
> 00 2c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
> 00 00 3e 37 63 ff fe cf 17 0e 00 01 00 00 02 00 \
> 00 00 66 83 c6 2a 32 09 bd 74 00 00"
> @@ -95,7 +95,7 @@ PTP_1588_IPV6_PDELAY_REQ=" \
> 33:33:00:00:00:6b 00:00:de:ad:be:ef 86:dd 60 0c \
> 5c fd 00 40 11 01 fe 80 00 00 00 00 00 00 3c 37 \
> 63 ff fe cf 17 0e ff 02 00 00 00 00 00 00 00 00 \
> -00 00 00 00 00 6b 01 3f 01 3f 00 40 b4 54 02 02 \
> +00 00 00 00 00 6b 01 3f 01 3f 00 40 89 1f 02 02 \
> 00 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
> 00 00 3e 37 63 ff fe cf 17 0e 00 01 00 01 05 7f \
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \
--
Alexander Sverdlin.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] selftests: forwarding: local_termination: fix PTP UDP cksums
2026-03-21 4:26 [PATCH net] selftests: forwarding: local_termination: fix PTP UDP cksums Daniel Golle
2026-03-21 12:19 ` Alexander Sverdlin
@ 2026-03-24 2:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-24 2:10 UTC (permalink / raw)
To: Daniel Golle
Cc: davem, edumazet, kuba, pabeni, horms, shuah, vladimir.oltean,
alexander.sverdlin, netdev, linux-kselftest, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sat, 21 Mar 2026 04:26:11 +0000 you wrote:
> All six PTP-over-IP test frames (3x IPv4 + 3x IPv6) contain incorrect
> UDP checksums. The stored values are the ones-complement sums of just
> the pseudo-headers, not the complete UDP checksums over pseudo-header +
> UDP header + payload. This is characteristic of frames captured on the
> sender before TX checksum offload completion.
>
> For example, the IPv4 Sync and Follow-Up frames both store checksum
> 0xa3c8 despite having different UDP payloads and port numbers - 0xa3c8
> is their shared pseudo-header sum (same src/dst IP, same protocol and
> UDP length).
>
> [...]
Here is the summary with links:
- [net] selftests: forwarding: local_termination: fix PTP UDP cksums
https://git.kernel.org/netdev/net-next/c/db3bd9e55c3c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-24 2:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-21 4:26 [PATCH net] selftests: forwarding: local_termination: fix PTP UDP cksums Daniel Golle
2026-03-21 12:19 ` Alexander Sverdlin
2026-03-24 2:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox