Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: forwarding: local_termination: fix PTP UDP cksums

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

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Link: https://patch.msgid.link/651c3decb80023e4395ec149fd81110afa3869a1.1774067006.git.daniel@makrotopia.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Daniel Golle and committed by
Jakub Kicinski
db3bd9e5 1a8dd884

+6 -6
+6 -6
tools/testing/selftests/net/forwarding/local_termination.sh
··· 57 57 PTP_1588_IPV4_SYNC=" \ 58 58 01:00:5e:00:01:81 00:00:de:ad:be:ef 08:00 45 00 \ 59 59 00 48 0a 9a 40 00 01 11 cb 88 c0 00 02 01 e0 00 \ 60 - 01 81 01 3f 01 3f 00 34 a3 c8 00 02 00 2c 00 00 \ 60 + 01 81 01 3f 01 3f 00 34 9f 41 00 02 00 2c 00 00 \ 61 61 02 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \ 62 62 63 ff fe cf 17 0e 00 01 00 00 00 00 00 00 00 00 \ 63 63 00 00 00 00 00 00" 64 64 PTP_1588_IPV4_FOLLOW_UP=" 65 65 01:00:5e:00:01:81 00:00:de:ad:be:ef 08:00 45 00 \ 66 66 00 48 0a 9b 40 00 01 11 cb 87 c0 00 02 01 e0 00 \ 67 - 01 81 01 40 01 40 00 34 a3 c8 08 02 00 2c 00 00 \ 67 + 01 81 01 40 01 40 00 34 eb 8a 08 02 00 2c 00 00 \ 68 68 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \ 69 69 63 ff fe cf 17 0e 00 01 00 00 02 00 00 00 66 83 \ 70 70 c6 0f 1d 9a 61 87" 71 71 PTP_1588_IPV4_PDELAY_REQ=" \ 72 72 01:00:5e:00:00:6b 00:00:de:ad:be:ef 08:00 45 00 \ 73 73 00 52 35 a9 40 00 01 11 a1 85 c0 00 02 01 e0 00 \ 74 - 00 6b 01 3f 01 3f 00 3e a2 bc 02 02 00 36 00 00 \ 74 + 00 6b 01 3f 01 3f 00 3e 9a b9 02 02 00 36 00 00 \ 75 75 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 37 \ 76 76 63 ff fe cf 17 0e 00 01 00 01 05 7f 00 00 00 00 \ 77 77 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" ··· 79 79 33:33:00:00:01:81 00:00:de:ad:be:ef 86:dd 60 06 \ 80 80 7c 2f 00 36 11 01 20 01 0d b8 00 01 00 00 00 00 \ 81 81 00 00 00 00 00 01 ff 0e 00 00 00 00 00 00 00 00 \ 82 - 00 00 00 00 01 81 01 3f 01 3f 00 36 2e 92 00 02 \ 82 + 00 00 00 00 01 81 01 3f 01 3f 00 36 14 76 00 02 \ 83 83 00 2c 00 00 02 00 00 00 00 00 00 00 00 00 00 00 \ 84 84 00 00 3e 37 63 ff fe cf 17 0e 00 01 00 00 00 00 \ 85 85 00 00 00 00 00 00 00 00 00 00 00 00" ··· 87 87 33:33:00:00:01:81 00:00:de:ad:be:ef 86:dd 60 0a \ 88 88 00 bc 00 36 11 01 20 01 0d b8 00 01 00 00 00 00 \ 89 89 00 00 00 00 00 01 ff 0e 00 00 00 00 00 00 00 00 \ 90 - 00 00 00 00 01 81 01 40 01 40 00 36 2e 92 08 02 \ 90 + 00 00 00 00 01 81 01 40 01 40 00 36 f0 47 08 02 \ 91 91 00 2c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ 92 92 00 00 3e 37 63 ff fe cf 17 0e 00 01 00 00 02 00 \ 93 93 00 00 66 83 c6 2a 32 09 bd 74 00 00" ··· 95 95 33:33:00:00:00:6b 00:00:de:ad:be:ef 86:dd 60 0c \ 96 96 5c fd 00 40 11 01 fe 80 00 00 00 00 00 00 3c 37 \ 97 97 63 ff fe cf 17 0e ff 02 00 00 00 00 00 00 00 00 \ 98 - 00 00 00 00 00 6b 01 3f 01 3f 00 40 b4 54 02 02 \ 98 + 00 00 00 00 00 6b 01 3f 01 3f 00 40 89 1f 02 02 \ 99 99 00 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ 100 100 00 00 3e 37 63 ff fe cf 17 0e 00 01 00 01 05 7f \ 101 101 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \