-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix alignment when using PacketBuffer reserve space (#19244)
* Fix alignment when using PacketBuffer reserve space #### Problem Some UDPEndPoint implementation code assumes that IPPacketInfo is aligned to 4 bytes, when storing one inside PacketBuffer reserved space. It would also fail to identify the available reserve if there was enough space, but less that 3 bytes more than enough. See #17213 Re-alignment logic makes incorrect assumptions #### Change overview Adds a PacketBuffer::GetReserve<T>() that returns a pointer in the buffer reserve space suitable in size and alignment for a T, and uses it for `GetPacketInfo()` in `UDPEndPointImplLwIP` and `UDPEndPointImplOT`. #### Testing Added a unit test, `PacketBufferTest::CheckGetReserve()`. * Use EnsureReservedSize()
- Loading branch information
1 parent
122ac1f
commit 2566969
Showing
5 changed files
with
216 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters