Skip to content

Querying the XDP program that is attached to an interface #1380

Answered by florianl
mpastyl asked this question in Q&A
Discussion options

You must be logged in to vote

Without further information, it might be hard to get from a Link to an interface. In addition, Link is only supported for Linux kernel version 5.7 and newer iirc.

Instead of querying the BPF syscall, I would recomment to walk the interfaces using rtnetlink. As shown in the example, one can query all interfaces quite easily and then further check the XDP element in the LinkAttributes in the returned LinkMessage. LinkXDP holds FD, which can be used as argument to NewProgramFromFD() to resolve the eBPF program.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@mpastyl
Comment options

@lmb
Comment options

@mpastyl
Comment options

@lmb
Comment options

@mpastyl
Comment options

Answer selected by mpastyl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants