diff --git a/pkg/flowaggregator/exporter/ipfix.go b/pkg/flowaggregator/exporter/ipfix.go index 35f46a9ac17..53b533d4ef2 100644 --- a/pkg/flowaggregator/exporter/ipfix.go +++ b/pkg/flowaggregator/exporter/ipfix.go @@ -151,11 +151,6 @@ func (e *IPFIXExporter) UpdateOptions(opt *options.Options) { } func (e *IPFIXExporter) sendRecord(record ipfixentities.Record, isRecordIPv6 bool) error { - templateID := e.templateIDv4 - if isRecordIPv6 { - templateID = e.templateIDv6 - } - if e.exportingProcess == nil { if err := initIPFIXExportingProcess(e); err != nil { // in case of error, the FlowAggregator flowExportLoop will retry after activeFlowRecordTimeout @@ -163,6 +158,11 @@ func (e *IPFIXExporter) sendRecord(record ipfixentities.Record, isRecordIPv6 boo } } + templateID := e.templateIDv4 + if isRecordIPv6 { + templateID = e.templateIDv6 + } + // TODO: more records per data set will be supported when go-ipfix supports size check when adding records e.set.ResetSet() if err := e.set.PrepareSet(ipfixentities.Data, templateID); err != nil {