From 7c52d81c0d066fff1070e029ceddb29dacaf3a85 Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 9 Aug 2023 19:49:00 -0700 Subject: [PATCH] producer: fix fragments (#190) --- producer/producer_sf.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/producer/producer_sf.go b/producer/producer_sf.go index 5ff5a871..ab949144 100644 --- a/producer/producer_sf.go +++ b/producer/producer_sf.go @@ -133,7 +133,7 @@ func ParseEthernetHeader(flowMessage *flowmessage.FlowMessage, data []byte, conf ttl = data[offset+8] identification = binary.BigEndian.Uint16(data[offset+4 : offset+6]) - fragOffset = binary.BigEndian.Uint16(data[offset+6 : offset+8]) + fragOffset = binary.BigEndian.Uint16(data[offset+6:offset+8]) & 8191 offset += 20 } @@ -163,7 +163,7 @@ func ParseEthernetHeader(flowMessage *flowmessage.FlowMessage, data []byte, conf } appOffset := 0 - if len(data) >= offset+4 && (nextHeader == 17 || nextHeader == 6) { + if len(data) >= offset+4 && (nextHeader == 17 || nextHeader == 6) && fragOffset&8191 == 0 { srcPort = binary.BigEndian.Uint16(data[offset+0 : offset+2]) dstPort = binary.BigEndian.Uint16(data[offset+2 : offset+4]) }