Limit SunRPC record fragments#2516
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2516 +/- ##
==========================================
- Coverage 69.24% 69.18% -0.07%
==========================================
Files 345 345
Lines 46747 46803 +56
==========================================
+ Hits 32372 32379 +7
- Misses 12330 12394 +64
+ Partials 2045 2030 -15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
I requested @damemi as a reviewer. |
Yeah, not sure either. It seemed reasonable for OBI's current use, but it is heuristic, not a SunRPC-standard value. RFC 5531 does not cap RM fragment count. For OBI’s current captured-buffer use, 64 is intentionally generous: generic TCP large buffers max out at 64 KiB, so this still allows roughly 1 KiB average fragments while bounding zero/tiny-fragment amplification. If we ever reuse this as a full-stream SunRPC parser, we may want a different limit or a configurable one. But seems reasonable for now. |
Motivation
Description
maxRecordFragments = 64and wire it into the SunRPC reader to reject pathological records early inreadRecordinpkg/internal/sunrpcparser/parser.goby returningErrNotSunRPCwhen the cap is exceeded.pkg/internal/sunrpcparser/parser_test.goto cover a valid fragmentedCALL, rejection of too many fragments, and acceptance of empty non-final fragments.wrapTCPRecordFragmentstest helper for constructing multi-fragment records.Testing
go test ./pkg/internal/sunrpcparser