Skip to content

Commit

Permalink
Fix template ID error in IPFIX exporter (#6630) (#6634)
Browse files Browse the repository at this point in the history
The template ID is only available after the exporter has been
initialized.

With this fix, we avoid the following error for the first data record to
be exported:

```
error when sending IPFIX record: error when doing sanity check:process:
templateID 0 does not exist in exporting process
```

Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
  • Loading branch information
antoninbas authored Aug 28, 2024
1 parent 52bcd7f commit e484e8b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/flowaggregator/exporter/ipfix.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,18 @@ 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
return fmt.Errorf("error when initializing IPFIX exporting process: %v", err)
}
}

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 {
Expand Down

0 comments on commit e484e8b

Please sign in to comment.