Skip to content

Commit

Permalink
feat(decoders.sflow): Add decoding of ethernet flow record (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
srebhan committed Jul 18, 2024
1 parent a0f3df6 commit b19557c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions decoders/sflow/sflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,20 @@ func DecodeFlowRecord(header *RecordHeader, payload *bytes.Buffer) (FlowRecord,
}
sampledHeader.HeaderData = payload.Bytes()
flowRecord.Data = sampledHeader
case FLOW_TYPE_ETH:
sampledEth := SampledEthernet{
SrcMac: make([]byte, 6),
DstMac: make([]byte, 6),
}
if err := utils.BinaryDecoder(payload,
&sampledEth.Length,
sampledEth.SrcMac,
sampledEth.DstMac,
&sampledEth.EthType,
); err != nil {
return flowRecord, &RecordError{header.DataFormat, err}
}
flowRecord.Data = sampledEth
case FLOW_TYPE_IPV4:
sampledIP := SampledIPv4{
SampledIPBase: SampledIPBase{
Expand Down

0 comments on commit b19557c

Please sign in to comment.