Skip to content

Commit

Permalink
added more debug info to the dns ebpf hook
Browse files Browse the repository at this point in the history
Added the path to the libc as well as the calculated offset for the
uprobe.
Don't return on the first error found loading a uprobe, instead try all
the uprobes and return if the loaded uprobes are 0.
  • Loading branch information
gustavo-iniguez-goya committed Jan 26, 2024
1 parent d55e567 commit 55678b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions daemon/dns/ebpfhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ func ListenerEbpf(ebpfModPath string) error {
probeFunction = strings.Replace(probeFunction, "uprobe/", "", 1)
offset, err := lookupSymbol(libcElf, probeFunction)
if err != nil {
log.Warning("EBPF-DNS: Failed to find symbol for uprobe %s : %s\n", uprobe.Name, err)
log.Warning("EBPF-DNS: Failed to find symbol for uprobe %s (offset: %d): %s\n", uprobe.Name, offset, err)
continue
}
err = bpf.AttachUprobe(uprobe, libcFile, offset)
if err != nil {
log.Error("EBPF-DNS: Failed to attach uprobe %s : %s\n", uprobe.Name, err)
return err
log.Warning("EBPF-DNS: Failed to attach uprobe %s : %s, (%s, %d)\n", uprobe.Name, err, libcFile, offset)
continue
}
probesAttached++
}
Expand Down

0 comments on commit 55678b4

Please sign in to comment.