You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.
I've noticed that when I explicitly set XDP_FLAGS_SKB_MODE in xdp.DefaultXdpFlags, removing a program from an interface never completes. I've tracked the issue down to here:
I don't know if this is an artifact of my system, or if this is a more general issue, but if you think it's worth it I can make a PR.
MVP
I took this from one of the examples and modified/commented it to show the issue I'm seeing.
package main
import (
"flag""fmt""net""github.com/asavie/xdp""golang.org/x/sys/unix"
)
funcmain() {
varlinkNamestringvarqueueIDintflag.StringVar(&linkName, "linkname", "enp0s6f1", "The network link on which rebroadcast should run on.")
flag.IntVar(&queueID, "queueid", 0, "The ID of the Rx queue to which to attach to on the network link.")
flag.Parse()
interfaces, err:=net.Interfaces()
iferr!=nil {
fmt.Printf("error: failed to fetch the list of network interfaces on the system: %v\n", err)
return
}
Ifindex:=-1for_, iface:=rangeinterfaces {
ififace.Name==linkName {
Ifindex=iface.Indexbreak
}
}
ifIfindex==-1 {
fmt.Printf("error: couldn't find a suitable network interface to attach to\n")
return
}
// NOTE: The important bit!xdp.DefaultXdpFlags=unix.XDP_FLAGS_SKB_MODEfmt.Println("creating new program")
program, err:=xdp.NewProgram(queueID+1)
iferr!=nil {
fmt.Printf("error: failed to create xdp program: %v\n", err)
return
}
deferfunc() {
fmt.Println("closing program")
program.Close()
}()
fmt.Printf("attaching program to ifidx %d\n", Ifindex)
iferr:=program.Attach(Ifindex); err!=nil {
fmt.Printf("error: failed to attach xdp program to interface: %v\n", err)
return
}
deferfunc() {
fmt.Println("detaching program")
// NOTE: Without the diff above, this call hangs indefinitelyprogram.Detach(Ifindex)
}()
fmt.Println("creating new XDP socket")
xsk, err:=xdp.NewSocket(Ifindex, queueID, nil)
iferr!=nil {
fmt.Printf("error: failed to create an XDP socket: %v\n", err)
return
}
fmt.Println("registering socket with program")
iferr:=program.Register(queueID, xsk.FD()); err!=nil {
fmt.Printf("error: failed to register socket in BPF map: %v\n", err)
return
}
deferfunc() {
fmt.Println("unregistering socket")
program.Unregister(queueID)
}()
fmt.Println("done")
}
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi!
I've noticed that when I explicitly set
XDP_FLAGS_SKB_MODE
inxdp.DefaultXdpFlags
, removing a program from an interface never completes. I've tracked the issue down to here:xdp/program.go
Lines 257 to 259 in 56d7123
If I change the call from
netlink.LinkSetXdpFd()
tonetlink.LinkSetXdpFdWithFlags()
and pass inxdp.DefaultXdpFlags
, then the detach works:I don't know if this is an artifact of my system, or if this is a more general issue, but if you think it's worth it I can make a PR.
MVP
I took this from one of the examples and modified/commented it to show the issue I'm seeing.
The text was updated successfully, but these errors were encountered: