Lines Matching refs:checksum
29 #include "checksum.h"
47 55, (p), (c1), (c2), /* TTL=55, protocol=p, checksum=c1,c2 */ \
70 0x00, UDP_LEN, 0, 0, /* Length 21, checksum empty for now */
75 0x08, 0x00, 0x88, 0xd0, /* Type 8, code 0, checksum 0x88d0 */ \
79 0x80, 0x00, 0xc3, 0x42, /* Type 128, code 0, checksum 0xc342 */ \
213 EXPECT_EQ(0, ip_checksum(ip, sizeof(*ip))) << msg << ": Incorrect IP checksum\n";
257 // If we understand the payload, verify the checksum.
259 uint16_t checksum;
264 checksum = ip_checksum_finish(ip_checksum_add(pseudo_checksum, payload, payload_length));
267 checksum = ip_checksum(payload, payload_length);
270 checksum = 0; // Don't check.
273 EXPECT_EQ(0, checksum) << msg << ": Incorrect transport checksum\n";
278 EXPECT_NE(0, udp->check) << msg << ": UDP checksum 0 should be 0xffff";
355 // Fix up the reassembled headers to reflect fragmentation and length (and IPv4 checksum).
658 // Check that the IID is checksum-neutral with the NAT64 prefix and the
674 << " not checksum-neutral with " << ipv4_str << " and " << plat_str
676 << "\n IPv4 checksum: " << c1
677 << "\n IPv6 checksum: " << c2
758 ASSERT_EQ(kUdpV4Checksum, udp->check) << "UDP/IPv4 packet checksum sanity check\n";
764 ASSERT_EQ(kUdpV6Checksum, udp->check) << "UDP/IPv6 packet checksum sanity check\n";
814 << "UDP partial checksum\n";
816 << "Payload partial checksum\n";
824 EXPECT_EQ(0x3ad0U, ipv4_pseudo_sum) << "IPv4 pseudo-checksum sanity check\n";
825 EXPECT_EQ(0x2644bU, ipv6_pseudo_sum) << "IPv6 pseudo-checksum sanity check\n";
829 << "Unexpected UDP/IPv4 checksum\n";
833 << "Unexpected UDP/IPv6 checksum\n";
837 << "Adjust IPv4/UDP checksum to IPv6\n";
840 << "Adjust IPv6/UDP checksum to IPv4\n";
845 uint16_t checksum;
860 uint16_t result = ip_checksum_adjust(data->checksum, data->old_hdr_sum, data->new_hdr_sum);
862 << "Incorrect checksum" << std::showbase << std::hex
865 << "\n checksum=" << data->checksum
904 // do_translate_packet already checks packets for validity and verifies the checksum.
910 << "Not checksum neutral: original and translated checksums differ\n";
914 // Generate a random clat IPv6 address and check that translation is checksum-neutral.
922 // Check that translating UDP packets is checksum-neutral. First, IPv4.
926 "UDP/IPv4 -> UDP/IPv6 checksum neutral");
935 "UDP/IPv4 -> UDP/IPv6 checksum neutral");