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

Fix haveProgTestRun on kernel version 5.15.65 #788

Merged
merged 1 commit into from Sep 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions prog.go
Expand Up @@ -624,8 +624,12 @@ var haveProgTestRun = internal.FeatureTest("BPF_PROG_TEST_RUN", "4.12", func() e
}
defer prog.Close()

// Programs require at least 14 bytes input
in := make([]byte, 14)
// Programs require at least 15 bytes input
// Looking in net/bpf/test_run.c, bpf_test_init() requires that the input is
// at least ETH_HLEN (14) bytes. A recent patch[0] also ensures that the skb
// is not empty after the layer 2 header is removed.
// [0]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fd1894224407c484f652ad456e1ce423e89bb3eb
in := make([]byte, 15)
attr := sys.ProgRunAttr{
ProgFd: uint32(prog.FD()),
DataSizeIn: uint32(len(in)),
Expand Down