From 3aa3fa6b2d133713755874c59515a5caf1d3a1a1 Mon Sep 17 00:00:00 2001 From: soypat Date: Wed, 28 May 2025 23:25:27 -0300 Subject: [PATCH] add additional validation to new TCP checksum test --- lneto_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lneto_test.go b/lneto_test.go index 2577325..a25a0ae 100644 --- a/lneto_test.go +++ b/lneto_test.go @@ -129,10 +129,17 @@ func TestIPv4TCPChecksum(t *testing.T) { 0xfa, 0xf0, 0xde, 0x02, 0x00, 0x00, 0x02, 0x04, 0x05, 0xb4, 0x04, 0x02, 0x08, 0x0a, 0xbb, 0xac, 0x9b, 0xca, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x07}, } + var vld lneto.Validator for _, tcpPacket := range tcpPackets { efrm, _ := ethernet.NewFrame(tcpPacket) + efrm.ValidateSize(&vld) ifrm, _ := ipv4.NewFrame(efrm.Payload()) + ifrm.ValidateSize(&vld) tfrm, _ := tcp.NewFrame(ifrm.Payload()) + tfrm.ValidateExceptCRC(&vld) + if err := vld.Err(); err != nil { + t.Fatal(err) + } wantCRC := ifrm.CRC() gotCRC := ifrm.CalculateHeaderCRC() if wantCRC != gotCRC {