Skip to content

Commit

Permalink
Merge branch 'main' into decoders/netflow-template
Browse files Browse the repository at this point in the history
  • Loading branch information
lspgn authored Dec 1, 2023
2 parents 77c2f9c + a1750f5 commit 50ad314
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions decoders/netflow/netflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,10 @@ func DecodeDataSet(version uint16, payload *bytes.Buffer, listFields []Field) ([
}

func DecodeMessageCommon(payload *bytes.Buffer, templates NetFlowTemplateSystem, obsDomainId uint32, size, version uint16) (flowSets []interface{}, err error) {
for i := 0; ((i < int(size) && version == 9) || version == 10) && payload.Len() > 0; i++ {
func DecodeMessageCommon(payload *bytes.Buffer, templates NetFlowTemplateSystem, obsDomainId uint32, size, version uint16) (flowSets []interface{}, err error) {

Check failure on line 287 in decoders/netflow/netflow.go

View workflow job for this annotation

GitHub Actions / Build

syntax error: unexpected DecodeMessageCommon, expected (
var read int
startSize := payload.Len()
for i := 0; ((i < int(size) && version == 9) || (uint16(read) < size && version == 10)) && payload.Len() > 0; i++ {
if flowSet, lerr := DecodeMessageCommonFlowSet(payload, templates, obsDomainId, version); lerr != nil && !errors.Is(lerr, ErrorTemplateNotFound) {
return flowSets, lerr
} else {
Expand All @@ -293,6 +296,7 @@ func DecodeMessageCommon(payload *bytes.Buffer, templates NetFlowTemplateSystem,
err = errors.Join(err, lerr)
}
}
read = startSize - payload.Len()
}
return flowSets, err
}
Expand Down Expand Up @@ -485,7 +489,7 @@ func DecodeMessageIPFIX(payload *bytes.Buffer, templates NetFlowTemplateSystem,
/*size = packetIPFIX.Length
packetIPFIX.Version = version
obsDomainId = packetIPFIX.ObservationDomainId*/
flowSets, err := DecodeMessageCommon(payload, templates, packetIPFIX.ObservationDomainId, packetIPFIX.Length, 10)
flowSets, err := DecodeMessageCommon(payload, templates, packetIPFIX.ObservationDomainId, packetIPFIX.Length-16, 10)
packetIPFIX.FlowSets = flowSets
if err != nil {
return &DecoderError{"IPFIX", err}
Expand Down

0 comments on commit 50ad314

Please sign in to comment.