Skip to content

Commit

Permalink
producer: fix fragments (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
lspgn authored Aug 10, 2023
1 parent 1298b94 commit 7c52d81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions producer/producer_sf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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])
}
Expand Down

0 comments on commit 7c52d81

Please sign in to comment.