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

producer: fix fragment (#214)

This commit is contained in:
Louis
2023-09-01 14:41:55 -07:00
committed by GitHub
parent bfb23ba283
commit 9f2b0806f0
2 changed files with 2 additions and 2 deletions

View File

@ -99,7 +99,7 @@ func ParseIPv4(offset int, flowMessage *ProtoProducerMessage, data []byte) (next
fragOffset := binary.BigEndian.Uint16(data[offset+6 : offset+8]) // also includes flag
flowMessage.FragmentId = uint32(identification)
flowMessage.FragmentOffset = uint32(fragOffset) & 57344
flowMessage.FragmentOffset = uint32(fragOffset) & 8191
flowMessage.IpFlags = uint32(fragOffset) >> 13
offset += 20

View File

@ -260,5 +260,5 @@ func TestProcessIPv4Fragment(t *testing.T) {
assert.Equal(t, uint32(0), flowMessage.IpFlags)
assert.Equal(t, uint32(64), flowMessage.IpTtl)
assert.Equal(t, uint32(24025), flowMessage.FragmentId)
assert.Equal(t, uint32(0), flowMessage.FragmentOffset)
assert.Equal(t, uint32(185), flowMessage.FragmentOffset)
}