Skip to content

Commit

Permalink
producer: fix fragment (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
lspgn committed Sep 1, 2023
1 parent bfb23ba commit 9f2b080
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion producer/proto/producer_sf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion producer/proto/producer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 9f2b080

Please sign in to comment.