-
Notifications
You must be signed in to change notification settings - Fork 5
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
Things to bear in mind while upstreaming struct packet changes #407
Comments
Just want to promote my pet idea that might support headroom without modifying the packet struct: Could allocate memory for packets on a 512-byte aligned address and then put the This way the packet struct would look the same and we would only be adding some incremental complexity to the "how we allocate packet memory" invariants. |
In practice, I think that's more or less the form we all want; the above issue is largely about documenting features to avoid in our current implementation as we move towards upstreaming something that fills this conceptual space. The point about exported buffer capacity needing to be smaller than the symbolically exported one to avoid buffer overflows regardless of the current amount of headroom/tailroom without careful fiddly work by all application developers still applies, though! |
-- Rationale: code which does bounds-checking on the constant representing the 10000 byte payload size otherwise needs to be headroom-aware. Merely using functions like packet.append is not a solution; there is no standardized way of returning errors, just asserts on overflows. Appending 9999 bytes to an empty packet after checking that 9999 is less than the exported data buffer size should be an operation that works.
-- We either need to:
--- get rid of the 'data' pointer abstraction
--- have a facility to clone packets to memory (with all the complication this entails - unlikely to be the right approach)
--- accept that copying the struct as a whole is going to lead to incorrect code (likely including code that has already been written) unless the caller is aware of the current definition of struct packet and its implications
--- as a consequence of the third option, require that code either be aware of struct packet details, or make heavier use of clone+free in contexts where conceptually, clone_to_memory is needed. Perhaps this is a rare enough case to be workable... :/
The text was updated successfully, but these errors were encountered: