Skip to content

Commit

Permalink
Need to differentiate between cached dns response vs incomplete ones …
Browse files Browse the repository at this point in the history
…[BP] (#402)

* Need to differentiate between cached dns response vs incomplete ones

Signed-off-by: Mohamed Mahmoud <[email protected]>
(cherry picked from commit 1f10618)
Signed-off-by: Mohamed Mahmoud <[email protected]>

* fix issue with protocol matching

Signed-off-by: Mohamed Mahmoud <[email protected]>

---------

Signed-off-by: Mohamed Mahmoud <[email protected]>
  • Loading branch information
msherif1234 authored Sep 3, 2024
1 parent 00b0d22 commit d7243ea
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions bpf/flows_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ static __always_inline int do_flow_filter_lookup(flow_id *id, struct filter_key_
}
break;
}
} else {
result = 0;
goto end;
}

if (!is_zero_ip(rule->ip, len)) {
Expand Down
Binary file modified pkg/ebpf/bpf_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/ebpf/bpf_powerpc_bpfel.o
Binary file not shown.
Binary file modified pkg/ebpf/bpf_s390_bpfeb.o
Binary file not shown.
Binary file modified pkg/ebpf/bpf_x86_bpfel.o
Binary file not shown.
1 change: 1 addition & 0 deletions pkg/flow/deduper.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func (c *deduperCache) checkDupe(r *Record, justMark, mergeDup bool, fwd *[]*Rec
fEntry.dnsRecord.Flags = r.Metrics.DnsRecord.Flags
fEntry.dnsRecord.Id = r.Metrics.DnsRecord.Id
fEntry.dnsRecord.Latency = r.Metrics.DnsRecord.Latency
fEntry.dnsRecord.Errno = r.Metrics.DnsRecord.Errno
}
// If the new flow has flowRTT then enrich the flow in the case with the same RTT and mark it duplicate
if r.Metrics.FlowRtt != 0 && *fEntry.flowRTT == 0 {
Expand Down
1 change: 0 additions & 1 deletion pkg/flow/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ func Accumulate(r *ebpf.BpfFlowMetrics, src *ebpf.BpfFlowMetrics) {
r.DnsRecord.Flags |= src.DnsRecord.Flags
if src.DnsRecord.Id != 0 {
r.DnsRecord.Id = src.DnsRecord.Id
r.DnsRecord.Errno = src.DnsRecord.Errno
}
if r.DnsRecord.Errno != src.DnsRecord.Errno {
r.DnsRecord.Errno = src.DnsRecord.Errno
Expand Down

0 comments on commit d7243ea

Please sign in to comment.