1
0
mirror of https://github.com/netsampler/goflow2.git synced 2024-05-06 15:54:52 +00:00

producer: fix fragments (#196)

This commit is contained in:
Louis
2023-08-09 19:57:45 -07:00
committed by GitHub
parent a705ba8705
commit 458e90777f

View File

@ -114,7 +114,7 @@ func ParseEthernetHeader(flowMessage *ProtoProducerMessage, data []byte, config
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
for _, configLayer := range GetSFlowConfigLayer(config, "ipv4") {
extracted := GetBytes(data, offset*8+configLayer.Offset, configLayer.Length)
@ -164,7 +164,7 @@ func ParseEthernetHeader(flowMessage *ProtoProducerMessage, data []byte, config
}
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])
}