From f75c1470c9eaf32da182ec1d5908962742d17af1 Mon Sep 17 00:00:00 2001 From: Alex Konradi Date: Wed, 4 Jan 2023 13:53:11 -0800 Subject: [PATCH] Remove expectation that IP header ID field is non-zero This expectation doesn't match the code, which produces ID field values by incrementing a counter which can roll over. Linux also does not guarantee non-zero ID fields. Fixes #8340 PiperOrigin-RevId: 499570695 --- test/syscalls/linux/raw_socket_hdrincl.cc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/syscalls/linux/raw_socket_hdrincl.cc b/test/syscalls/linux/raw_socket_hdrincl.cc index d45bd07bc..52b745f0f 100644 --- a/test/syscalls/linux/raw_socket_hdrincl.cc +++ b/test/syscalls/linux/raw_socket_hdrincl.cc @@ -272,9 +272,6 @@ TEST_F(RawHDRINCL, SendAndReceive) { // The network stack should have set the source address. EXPECT_EQ(src.sin_family, AF_INET); EXPECT_EQ(absl::gbswap_32(src.sin_addr.s_addr), INADDR_LOOPBACK); - // The packet ID should not be 0, as the packet has DF=0. - struct iphdr* iphdr = reinterpret_cast(recv_buf); - EXPECT_NE(iphdr->id, 0); } // Send and receive a packet where the sendto address is not the same as the @@ -324,10 +321,8 @@ TEST_F(RawHDRINCL, SendAndReceiveDifferentAddress) { // The network stack should have set the source address. EXPECT_EQ(src.sin_family, AF_INET); EXPECT_EQ(absl::gbswap_32(src.sin_addr.s_addr), INADDR_LOOPBACK); - // The packet ID should not be 0, as the packet has DF=0. struct iphdr recv_iphdr = {}; memcpy(&recv_iphdr, recv_buf, sizeof(recv_iphdr)); - EXPECT_NE(recv_iphdr.id, 0); // The destination address is kUnreachable despite arriving via loopback. EXPECT_EQ(recv_iphdr.daddr, kUnreachable); } @@ -386,7 +381,6 @@ TEST_F(RawHDRINCL, SendAndReceiveIPHdrIncl) { EXPECT_EQ(absl::gbswap_32(src.sin_addr.s_addr), INADDR_LOOPBACK); struct iphdr iphdr = {}; memcpy(&iphdr, recv_buf, sizeof(iphdr)); - EXPECT_NE(iphdr.id, 0); // Also verify that the packet we just sent was not delivered to the // IPPROTO_RAW socket.