-
Notifications
You must be signed in to change notification settings - Fork 651
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
program: Add TestWithContext #1042
Conversation
This commit adds the TestWithContext function, which allows the acceptance of customized context for eBPF tests and returns the context modified by the eBPF program. The input context will be cast to a `__sk_buff` struct for the tc program. For those who want to pass an skb with a special skb->mark or check the returned skb's metadata, TestWithContext can be useful for that purpose. Signed-off-by: gray <gray.liang@isovalent.com>
abe4a37
to
23c06bb
Compare
@jschwinger233 Does |
@ti-mo Thank you for reply. I did notice Lines 562 to 571 in 211b0e6
Calling |
The problem was fixed in torvalds/linux@b5a36b1 aka 5.0-rc1 if I read things right. You also need to call skb_adjust_head or similar to trigger it, with a non-nil Do you want to call this from production code or from tests? If it's just from tests I'd suggest we just turn the panic into an error, and have the caller deal with it. For production we might need to solve this in |
@lmb I'm adding BPF test cases for cilium's IPSec feature, which requires me to check skb->mark after the execution of a BPF program, please see the draft PR: cilium/cilium#25699 In the PR above, I have to define a function |
Maybe just allocate a maximally sized |
Sounds good, thank you! |
This commit adds the TestWithContext function, which allows the acceptance of customized context for eBPF tests and returns the context modified by the eBPF program.
The input context will be cast to a
__sk_buff
struct for the tc program. For those who want to pass an skb with a special skb->mark or check the returned skb's metadata, TestWithContext can be useful for that purpose.Signed-off-by: Zhichuan Liang gray.liang@isovalent.com