Closed mieczkowski closed 1 year ago
My guess: decoders/netflow/netflow.go +397
case IPFIXOptionsTemplateRecord:
records, err := DecodeOptionsDataSet(version, dataReader, templatec.Scopes, templatec.Options)
if err != nil {
return flowSet, &FlowError{version, "DataSet", obsDomainId, fsheader.Id, err}
}
spew.Dump(records)
In v1.3.5 there are values (and our sampling rate), but in v2.0.0 there is filled list with zero values
([]netflow.OptionsDataRecord) (len=1 cap=1) {
(netflow.OptionsDataRecord) {
ScopesValues: ([]netflow.DataField) (len=1 cap=1) {
(netflow.DataField) {
PenProvided: (bool) false,
Type: (uint16) 144,
Pen: (uint32) 0,
Value: ([]uint8) (len=4 cap=8924) {
00000000 0a 11 00 00 |....|
}
}
},
OptionsValues: ([]netflow.DataField) (len=10 cap=10) {
(netflow.DataField) {
PenProvided: (bool) false,
Type: (uint16) 0,
Pen: (uint32) 0,
Value: (interface {}) <nil>
},
(netflow.DataField) {
PenProvided: (bool) false,
Type: (uint16) 0,
Pen: (uint32) 0,
Value: (interface {}) <nil>
},
(netflow.DataField) {
PenProvided: (bool) false,
Type: (uint16) 0,
Pen: (uint32) 0,
Value: (interface {}) <nil>
},
(...)
versus 1.3.5:
([]netflow.OptionsDataRecord) (len=1 cap=1) {
(netflow.OptionsDataRecord) {
ScopesValues: ([]netflow.DataField) (len=1 cap=1) {
(netflow.DataField) {
PenProvided: (bool) false,
Type: (uint16) 144,
Pen: (uint32) 0,
Value: ([]uint8) (len=4 cap=60) {
00000000 00 00 00 02 |....|
}
}
},
OptionsValues: ([]netflow.DataField) (len=10 cap=10) {
(netflow.DataField) {
PenProvided: (bool) false,
Type: (uint16) 41,
Pen: (uint32) 0,
Value: ([]uint8) (len=8 cap=56) {
00000000 00 00 00 00 00 01 ea ef |........|
}
},
(netflow.DataField) {
PenProvided: (bool) false,
Type: (uint16) 42,
Pen: (uint32) 0,
Value: ([]uint8) (len=8 cap=48) {
00000000 00 00 00 00 00 01 ed 31 |.......1|
}
},
(...)
Thank you for the report! Will have a look asap.
Might be related to #113 if you need to use the custom mapping. In that case, could you run GoFlow2 with -produce=raw
?
~But also could be the decoding error you identified. Are you able to share a template+data or a packet capture?~
Figured it out. Fix is in #207, are you able to test the bugfix/sampling
branch?
Wow, thank you for quick response and fix. I can confirm that this change works :)
{"type":"IPFIX","time_received_ns":1692776265077063604,"sampling_rate":500,"packets":1,"bytes":52}
{"type":"IPFIX","time_received_ns":1692776265077063604,"sampling_rate":500,"packets":1,"bytes":40}
{"type":"IPFIX","time_received_ns":1692776265077063604,"sampling_rate":500,"packets":1,"bytes":40}
{"type":"IPFIX","time_received_ns":1692776265077063604,"sampling_rate":500,"packets":3,"bytes":224}
Describe the bug
In version 2.0.0 with no mapping config (or with provided in cmd/goflow2/mapping)
sampling_rate
in IPFIX (maybe in netflow_v9 too?) is always 0.With previous version (v1.3.5) it is filled with correct value.
In sflow everything is ok.
To Reproduce
mapping.yaml:
After checkout to v1.3.5 and run without mapping:
Expected behavior sampling_rate in IPFIX should be filled
GoFlow2:
go run