Skip to content

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

Closed 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 7 replies

Comment options

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

@lmb
Comment options

@mpastyl
Comment options

@ti-mo
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
4 participants