Skip to content

Commit

Permalink
Ensure port parsing is skipped for IP protocols other than TCP/UDP
Browse files Browse the repository at this point in the history
  • Loading branch information
fako1024 committed May 9, 2024
1 parent 04badc6 commit e6a3dc7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/capture/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ func ParsePacketV4(ipLayer capture.IPLayer) (epHash capturetypes.EPHashV4, auxIn
}

auxInfo = ipLayer[ipv4.HeaderLen] // store ICMP type
goto finalize
}
goto finalize

ports:
dport = ipLayer[ipLayerV4DPortStart:ipLayerV4DPortEnd]
Expand Down Expand Up @@ -236,8 +236,8 @@ func ParsePacketV6(ipLayer capture.IPLayer) (epHash capturetypes.EPHashV6, auxIn
}

auxInfo = ipLayer[ipv6.HeaderLen] // store ICMP type
goto finalize
}
goto finalize

ports:
dport = ipLayer[ipLayerV6DPortStart:ipLayerV6DPortEnd]
Expand Down
4 changes: 2 additions & 2 deletions pkg/e2etest/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,12 @@ func testE2E(t *testing.T, valFilterDescriptor int, datasets ...[]byte) {
for it := aggMap.PrimaryMap.Iter(); it.Next(); {
compVal, exists := liveResults.PrimaryMap.Get(it.Key())
require.True(t, exists)
require.EqualValues(t, it.Val(), compVal)
require.EqualValuesf(t, it.Val(), compVal, "mismatching key: %v", types.Key(it.Key()))
}
for j, it := 0, aggMap.SecondaryMap.Iter(); it.Next(); j++ {
compVal, exists := liveResults.SecondaryMap.Get(it.Key())
require.True(t, exists)
require.EqualValues(t, it.Val(), compVal)
require.EqualValuesf(t, it.Val(), compVal, "mismatching key: %v", types.Key(it.Key()))
}
}

Expand Down

0 comments on commit e6a3dc7

Please sign in to comment.