Skip to content

Commit

Permalink
Quit ebpf-dns if no uprobes are attached
Browse files Browse the repository at this point in the history
  • Loading branch information
calesanz committed Feb 10, 2022
1 parent 8f89f98 commit 11c363b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion daemon/dns/ebpfhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func DnsListenerEbpf() error {
log.Error("EBPF-DNS: Failed to open %s: %v", libcFile, err)
return err
}

probes_attached := 0
for uprobe := range m.IterUprobes() {
probeFunction := strings.Replace(uprobe.Name, "uretprobe/", "", 1)
probeFunction = strings.Replace(probeFunction, "uprobe/", "", 1)
Expand All @@ -129,6 +129,12 @@ func DnsListenerEbpf() error {
log.Error("EBPF-DNS: Failed to attach uprobe %s : %s\n", uprobe.Name, err)
return err
}
probes_attached++
}

if probes_attached == 0 {
log.Warning("EBPF-DNS: Failed to find symbols for uprobes.")
return errors.New("Failed to find symbols for uprobes.")
}

// Reading Events
Expand Down

0 comments on commit 11c363b

Please sign in to comment.