fix: frame/payload ceilings, MX log level, framing comment corrections - #66
Merged
Conversation
The fallback fires on every M-SEARCH, retransmits included, so one non-conformant client keeps flooding the default level. The search is reflected either way.
Linux's receive scratch is MAX_FRAME_SIZE, so recv(MSG_TRUNC) already surfaces anything larger for the drop. The BPF path reads into a BIOCGBLEN-sized batch instead, which happily delivers a fully-captured frame the send path could never re-emit; the walker now applies the same ceiling. The former send/receive size constants were the same 4 KiB for the same reason, so they merge into one MAX_FRAME_SIZE.
consumed == 0 also happens mid-body, when a chunk-size line splits across reads -- three comments claimed it only meant an incomplete header. StreamBuffer::Commit's contract forbids an interleaved mutating call: Consume and a second ReserveTail both compact, so committing afterwards publishes stale tail bytes into the forwarded stream. The per-session Registration was called `capture`, which is also what the sockets it registers on are called.
The rewrite can grow the datagram past what the send path can frame, where it failed at the frame builder and was dropped three logs deep. Cap it against MAX_UDP_PAYLOAD_SIZE at the rewrite instead. Forwarding the original is not the fallback here: on the segment where the rewrite matters, the device's own LOCATION is unreachable from the client, so a verbatim copy advertises a dead address for clients to cache and time out on.
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.
Four independent fixes, one commit each.
recv(MSG_TRUNC)already surfaces oversized frames for the drop, but the BPF path reads into a BIOCGBLEN-sized batch and happily delivered a fully-captured frame the send path could never re-emit. The former send/receive size constants (both 4 KiB, same rationale) merge into oneMAX_FRAME_SIZE.consumed == 0also happens mid-body when a chunk-size line splits across reads, which three comments denied;StreamBuffer::Commit's no-interleaved-mutation contract is now stated; the per-sessionRegistrationwas calledcapture, which is also what the sockets it registers on are called.MAX_UDP_PAYLOAD_SIZEand dropped: forwarding the original would advertise the device address the rewrite exists to replace.Native (888) and docker/Linux (875) unit suites green. The DIAL cap and the BPF ceiling were each verified to fail their test when the guard is stubbed out.