Skip to content

Commit

Permalink
chore(bpf): Optimize BPF attachment by skipping netdev hooks when not…
Browse files Browse the repository at this point in the history
… using TC backend (#209)
  • Loading branch information
mozillazg authored Dec 8, 2024
1 parent 0308649 commit 7d71bb8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/capturer/capturer.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ func (c *Capturer) Prepare() error {
if !c.opts.AllDev {
bpfopts = bpfopts.WithIfindexes(c.ifindexes())
}
if c.opts.Backend != types.NetHookBackendTc {
bpfopts = bpfopts.WithHookMount(false).WithHookNetDev(false)
}

if err := bf.Load(*bpfopts); err != nil {
return fmt.Errorf("load bpf failed: %w", err)
Expand Down

0 comments on commit 7d71bb8

Please sign in to comment.