-
Notifications
You must be signed in to change notification settings - Fork 297
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
aya-ebpf: XdpContext
adjust_{head|tail|meta} API
#949
base: main
Are you sure you want to change the base?
Conversation
Added new public API for the `XdpContext`: - `adjust_head` : To grow the packet buffer at the beginning - `adjist_tail` : To grow the packet buffer at the end - `adjust_meta` : To grow metadata area These API are handy for packet processing when additional headers etc. are to be pushed to the packet. Also added these APIs using `cargo xtask public-api --bless` Refs: aya-rs#948
✅ Deploy Preview for aya-rs-docs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
I noticed from the comments in the code that passing a negative value can reduce the packet size, which would be very convenient for me. However, passing a negative value to the adjust_head method seems to increase the packet size. Am I missing something, or could there be an issue? Thank you. |
Yes, using the negative value adjust the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks ok - some comments
/// Adjusts the head of the Packet by given 'delta' (both positive and negative values are | ||
/// possible.) | ||
#[inline(always)] | ||
pub fn adjust_head(&mut self, delta: crate::cty::c_int) -> Result<(), ()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here and in the other methods I think we should use i32, not c_int.
unsafe { | ||
match bpf_xdp_adjust_head(self.ctx, delta) { | ||
0 => Ok(()), | ||
_ => Err(()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not return the error?
Added new public API for the
XdpContext
:adjust_head
: To grow the packet buffer at the beginningadjist_tail
: To grow the packet buffer at the endadjust_meta
: To grow metadata areaThese API are handy for packet processing when additional headers etc. are to be pushed to the packet.
Also added these APIs using
cargo xtask public-api --bless
Refs: #948
This change is