Skip to content

Commit 91e2a55

Browse files
committed
Do not re-attach when FD matches
1 parent 7a72925 commit 91e2a55

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/bpf/loader.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ func AttachNeighborHandlerToInterface(intf netlink.Link) error {
8484
if err != nil {
8585
return fmt.Errorf("error getting interface by name %s: %w", intf.Attrs().Name, err)
8686
}
87+
linkXdp := intf.Attrs().Xdp
88+
if linkXdp.Attached && nwopbpf.HandleNeighborReplyXdp.FD() == linkXdp.Fd {
89+
return nil
90+
}
8791
_, err = link.AttachXDP(link.XDPOptions{
8892
Program: nwopbpf.HandleNeighborReplyXdp,
8993
Interface: iface.Index,

0 commit comments

Comments
 (0)