Skip to content

Commit 1de15ff

Browse files
Asphalttbrb
authored andcommitted
Fix broken --filter-trace-xdp
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]>
1 parent 759fc7a commit 1de15ff

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

internal/pwru/tracing.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,20 @@ func TraceXDP(coll *ebpf.Collection, spec *ebpf.CollectionSpec,
189189
log.Printf("Attaching xdp progs...\n")
190190

191191
var t tracing
192-
if err := t.trace(coll, spec, opts, outputSkb, outputShinfo, n2a, ebpf.XDP, "fentry_xdp"); err != nil {
193-
log.Fatalf("failed to trace XDP progs: %v", err)
192+
{
193+
spec := spec.Copy()
194+
delete(spec.Programs, "fexit_xdp")
195+
if err := t.trace(coll, spec, opts, outputSkb, outputShinfo, n2a, ebpf.XDP, "fentry_xdp"); err != nil {
196+
log.Fatalf("failed to trace XDP progs: %v", err)
197+
}
194198
}
195-
if err := t.trace(coll, spec, opts, outputSkb, outputShinfo, n2a, ebpf.XDP, "fexit_xdp"); err != nil {
196-
log.Fatalf("failed to trace XDP progs: %v", err)
199+
200+
{
201+
spec := spec.Copy()
202+
delete(spec.Programs, "fentry_xdp")
203+
if err := t.trace(coll, spec, opts, outputSkb, outputShinfo, n2a, ebpf.XDP, "fexit_xdp"); err != nil {
204+
log.Fatalf("failed to trace XDP progs: %v", err)
205+
}
197206
}
198207

199208
return &t

0 commit comments

Comments
 (0)