-
Notifications
You must be signed in to change notification settings - Fork 247
docs/JAMULUS_PROTOCOL.md: message reference, directory flows, small fixes #3794
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
Open
mcfnord
wants to merge
2
commits into
jamulussoftware:main
Choose a base branch
from
mcfnord:enhance-protocol-doc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mm, leaves me asking how big an exploit surface that is -- I don't think it's that large as there aren't very many protocol messages that a malicious client could send to a server after initiating a connection that require a response that could have the ACKN unsent. But a spoofable sender address would open this.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 AI: Traced it.
CreateAndSendMessage()(protocol.cpp:577) is the only entry point onto the retransmit-until-ACK queue (SendMessQueue), used by 21 distinct message types — jitter-buffer size, client ID, channel gain/pan, mute state, connected-client list, channel info, chat text, network-transport props, split-message support, raw-audio support, licence-required, opus-supported, channel-level-list request, version/OS, recorder state. Audio doesn't go through this path — it's UDP fire-and-forget, separate from the ACK'd control-message queue.SendMessQueue(protocol.h:321, astd::list) has no size cap — nothing likeMAX_SIZE_MESS_QUEUEexists. There's also no dedup:EnqueueMessage()(protocol.cpp:519) unconditionallypush_back()s on every call, with no check for an existing entry of the sameiID. ACK handling only popsSendMessQueue.front()when itsiCntandiIDmatch the incomingACKN(protocol.cpp:709-719) — strict FIFO, one message retransmitted at a time regardless of queue depth.So repeated calls to the same setter do pile up, and there's a legitimate path that does exactly that:
CAudioMixerBoard::UpdateGainValue()(audiomixerboard.cpp:1858) emitsChangeChanGainon every unsuppressed fader update, unthrottled, which reachesCreateChanGainMes()viaCChannel::SetRemoteChanGain()(channel.h:134). Measured directly with a minimal headless harness linking the unmodifiedprotocol.cpp/.hand leavingMessReadyForSendingunconnected, so noACKNis ever processed: 200 calls toCreateChanGainMes()on one channel growSendMessQueueby exactly one entry per call, zero pops, ending at depth 200; repeated at 50000 calls, still perfectly linear with no cap encountered. Combined with the unbounded retransmit window from the earlier reply, a connection whose ACKs are being dropped or spoofed accumulates one queue entry per UI action indefinitely, not just per handshake step.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so every connection-oriented message, regardless of whether the recipient expects it (e.g. Client should not send something to Server...) get an ACKN back anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, it needs fixing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 AI: Yes, and it is wider than the message type. For a connected channel the acknowledgement is unconditional for anything that passes the frame and CRC check:
CreateAndImmSendAcknMesssits outside theswitch ( iRecIDModified )and outside theif ( bEvaluateMessage )guard, so no branch inside either can suppress it.Now it is measured, against a server built from an unmodified
main, over loopback. Each of these was sent to a connected channel 10 times and acknowledged all 10:PROTMESSID_REQ_JITT_BUF_SIZE, handled — the controlPROTMESSID_DISCONNECTION, defined but with nocasePROTMESSID_CLIENT_ID, which only ever travels server to clientPROTMESSID_JITT_BUF_SIZEwith a wrong-sized bodyThe last two are the ones worth noting: a body the evaluator rejects on size still gets acknowledged, and so does a split fragment that is never evaluated at all — the sender is told the message arrived and was accepted when nothing has read it.
Negative controls, same rig, 0/10 each: an
PROTMESSID_ACKNitself, a frame with a corrupted CRC, and a connectionless ID.One bound on it — this needs an established channel. An unconnected peer sending the same undefined ID gets 0/10, because the protocol path calls
FindChannelwithout allowing a new channel, so there is nothing to parse into.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That part is explicitly intentional in the design, I believe.
The only issue here is the "forever" part, really.