Skip to content

Commit

Permalink
Fix panic when failing to parse dns packet
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickpichler committed Apr 24, 2024
1 parent 6369aff commit 10c2477
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/ebpftracer/tracer_decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,15 @@ func (t *Tracer) decodeAndExportEvent(ctx context.Context, data []byte) (rerr er
event.EventType = castpb.EventType_EVENT_DNS

dnsEvent, err := decodeDNS(args.Payload, t.dnsPacketParser)
dnsEvent.FlowDirection = convertFlowDirection(eventCtx.ParseFlowDirection())

// If we cannot parse an DNS packet, we abord
if err != nil {
metrics.AgentDroppedEventsTotal.With(prometheus.Labels{metrics.EventTypeLabel: event.GetEventType().String()}).Inc()
return nil
}

dnsEvent.FlowDirection = convertFlowDirection(eventCtx.ParseFlowDirection())

event.Data = &castpb.Event_Dns{
Dns: dnsEvent,
}
Expand Down

0 comments on commit 10c2477

Please sign in to comment.