Skip to content

AttachXDP failed on Ubuntu 20.04, kernel version is 5.4 #1487

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

You must be logged in to vote

Hi @loveyacper

The eBPF program type XDP was introduced earlier (with 4.8 iirc) than bpf_link (5.7). As a consequence, bpf_link is expected to not be available on a 5.4 kernel.
You can still load XDP programs, but you have to use another method, like ip link set .... This package cilium/ebpf focuses on everything around the eBPF syscall - therefore it does not cover the loading via ip link set ....
A package, that supports loading of XDP on kernels that do not have support for bpf_link is jsimonetti/rtnetlink/v2#LinkService.Set.
Feel free to checkout https://gist.github.com/florianl/935cfcbeeee209537d8303165dab41e0 as an example for this.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by lmb
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1474 on June 11, 2024 08:00.