Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibBPF fails to load xdp_prog #39

Closed
g00g1 opened this issue May 15, 2023 · 3 comments
Closed

LibBPF fails to load xdp_prog #39

g00g1 opened this issue May 15, 2023 · 3 comments

Comments

@g00g1
Copy link

g00g1 commented May 15, 2023

I am sorry to bother you once more again, but since my previous issue (#38) I have tried to change environment where I am trying to evaluate and hack on this project.

The new host is:
CPU: 2x Intel(R) Xeon(R) Silver 4208
NIC: Intel Corporation Ethernet Controller XL710 for 40GbE QSFP+ (i40e)
Kernel: 5.14.0-70.13.1.el9_0.x86_64

I have successfully built xdpfw, but when running xdpfw -t 5 I have encountered LibBPF error, full log is attached below

xdpfw.txt

UPD: exactly the same behavior was reproduced on another machine (as in issue #38)

@g00g1
Copy link
Author

g00g1 commented May 15, 2023

I have increased BPF_COMPLEXITY_LIMIT_INSNS from 1000000 (1M) to 10000000 (10M) at include/linux/bpf.h and after kernel rebuild eBPF validator allowed the XDP program to load.

I think this should be mentioned at the README as it is important clarification - currently it is not possible to use XDP-Firewall without applying Linux kernel patch.

@gamemann
Copy link
Owner

Hey, thank you for reporting this and no need to be sorry!

It appears in newer Linux kernels the BPF limitations are more strict. Although, the complexity limit has always been 1 million which makes this issue strange to me. The firewall has worked for years until this issue arose.

I've decreased the maximum filters from 100 to 90 in commit 8fbab9b which resolves the issue without needing to apply a patch to the kernel. I'll update the README soon and add information from my XDP Forwarding project here that goes over how to increase the limits along with including a patch if anybody needs more than 90 filtering rules.

@gamemann
Copy link
Owner

I'm going to close this for now since the firewall builds successfully. Thank you again for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants