Finalmask header-custom: extend expression primitives for 1:1 handshakes#5949
Open
Finalmask header-custom: extend expression primitives for 1:1 handshakes#5949
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
le16,le32,le64pad,truncateadd,sub,and,or,shl,shrWhy
At this point, this is probably my last handshake-hardening follow-up for
header-custom.After reading several RFCs and comparing a few real handshakes, I made a short list of missing primitives that still blocked some 1:1 packet shapes. This PR is that list collected into one follow-up: little-endian encoding, byte shaping, and simple numeric / bitwise transforms.
The UX is not perfect, but I think it is already clear enough for the kind of user who would actually use
header-customat this level. I am also writing documentation for it gradually.Scope
transformsurface with little-endian packing opsheader-custommodel and runtime behavior unchanged outside the new opsNon-Goals
Test Plan
go test ./infra/conf -run 'Test(HeaderCustomUDPBuild|HeaderCustomTCPBuildRejectsMixedItemKinds|HeaderCustomUDPBuildRejectsInvalidVariableNames|HeaderCustomUDPBuildRejectsExprWithoutArgs)' -count=1go test ./transport/internet/finalmask/header/custom -count=1go test -race ./transport/internet/finalmask/header/custom -count=1go test ./transport/internet/finalmask -run 'Test(ConnReadWrite|PacketConnReadWrite|TCPcustomStaticHandshakeRoundTrip|TCPcustomClientRejectsMismatchedServerSequence|UDPcustomStaticHeaderWireShape|UDPcustomServerRejectsMismatchedStaticHeader)' -count=1mainbase:expr-smoke-okexpr-udp-smoke-ok