Skip to content

Commit

Permalink
Fix broken --filter-trace-xdp
Browse files Browse the repository at this point in the history
It fails to run with --filter-trace-xdp:

```bash
2024/09/24 15:38:48 Attaching xdp progs...
2024/09/24 15:38:48 failed to trace XDP progs: failed to trace bpf progs: failed to load objects:
program fexit_xdp: attach Tracing/TraceFExit: fexit xdp not supported
```

Signed-off-by: Leon Hwang <[email protected]>
  • Loading branch information
Asphaltt authored and brb committed Sep 26, 2024
1 parent 759fc7a commit 1de15ff
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions internal/pwru/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,20 @@ func TraceXDP(coll *ebpf.Collection, spec *ebpf.CollectionSpec,
log.Printf("Attaching xdp progs...\n")

var t tracing
if err := t.trace(coll, spec, opts, outputSkb, outputShinfo, n2a, ebpf.XDP, "fentry_xdp"); err != nil {
log.Fatalf("failed to trace XDP progs: %v", err)
{
spec := spec.Copy()
delete(spec.Programs, "fexit_xdp")
if err := t.trace(coll, spec, opts, outputSkb, outputShinfo, n2a, ebpf.XDP, "fentry_xdp"); err != nil {
log.Fatalf("failed to trace XDP progs: %v", err)
}
}
if err := t.trace(coll, spec, opts, outputSkb, outputShinfo, n2a, ebpf.XDP, "fexit_xdp"); err != nil {
log.Fatalf("failed to trace XDP progs: %v", err)

{
spec := spec.Copy()
delete(spec.Programs, "fentry_xdp")
if err := t.trace(coll, spec, opts, outputSkb, outputShinfo, n2a, ebpf.XDP, "fexit_xdp"); err != nil {
log.Fatalf("failed to trace XDP progs: %v", err)
}
}

return &t
Expand Down

0 comments on commit 1de15ff

Please sign in to comment.