1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-26 20:01:35 +01:00

Fix overall checksum calculation

This commit is contained in:
Matias Fontanini
2015-12-29 09:57:42 -03:00
parent afe778d03c
commit 67d31fd62c
7 changed files with 148 additions and 72 deletions

View File

@@ -51,6 +51,14 @@ TEST_F(TCPTest, ChecksumCheck) {
uint16_t checksum = tcp1.checksum();
PDU::serialization_type buffer = pkt1.serialize();
EXPECT_EQ(
TCP::serialization_type(
checksum_packet,
checksum_packet + sizeof(checksum_packet)
),
buffer
);
EthernetII pkt2(&buffer[0], (uint32_t)buffer.size());
const TCP &tcp2 = pkt2.rfind_pdu<TCP>();
EXPECT_EQ(checksum, tcp2.checksum());