From 12c4eb294a43f4a84a789871730869d164ef52c9 Mon Sep 17 00:00:00 2001 From: Austin Kiekintveld Date: Wed, 31 Jul 2019 11:25:25 -0700 Subject: Fix ICMPv4 EchoReply packet checksum The checksum was not being reset before being re-calculated and sent out. This caused the sent checksum to always be `0x0800`. Fixes #605. PiperOrigin-RevId: 260965059 --- test/syscalls/linux/raw_socket_icmp.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'test/syscalls/linux') diff --git a/test/syscalls/linux/raw_socket_icmp.cc b/test/syscalls/linux/raw_socket_icmp.cc index ad19120d5..1c07bacc2 100644 --- a/test/syscalls/linux/raw_socket_icmp.cc +++ b/test/syscalls/linux/raw_socket_icmp.cc @@ -470,9 +470,8 @@ void RawSocketICMPTest::ExpectICMPSuccess(const struct icmphdr& icmp) { EXPECT_EQ(recvd_icmp->un.echo.id, icmp.un.echo.id); // A couple are different. EXPECT_EQ(recvd_icmp->type, ICMP_ECHOREPLY); - // The checksum is computed in such a way that it is guaranteed to have - // changed. - EXPECT_NE(recvd_icmp->checksum, icmp.checksum); + // The checksum computed over the reply should still be valid. + EXPECT_EQ(Checksum(recvd_icmp), 0); break; } } -- cgit v1.2.3