Skip to content

Commit

Permalink
allow unknown records for sFlow (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
lspgn authored Apr 16, 2023
1 parent 5d47e60 commit 958109e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 1 addition & 5 deletions decoders/sflow/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,13 @@ type RecordHeader struct {

type FlowRecord struct {
Header RecordHeader
Data interface{} // replace by FlowRecordData
Data interface{}
}

type FlowRecordRaw struct {
Data []byte
}

type FlowRecordData interface {
GetBytes(offset int, length int, dst []byte) error
}

type CounterRecord struct {
Header RecordHeader
Data interface{}
Expand Down
4 changes: 3 additions & 1 deletion decoders/sflow/sflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ func DecodeCounterRecord(header *RecordHeader, payload *bytes.Buffer) (CounterRe
}
counterRecord.Data = ethernetCounters
default:
return counterRecord, NewErrorDataFormat((*header).DataFormat)
counterRecord.Data = &FlowRecordRaw{
Data: payload.Next(int(header.Length)),
}
}

return counterRecord, nil
Expand Down

0 comments on commit 958109e

Please sign in to comment.