server: apply TCP-AO to peer sockets - #3584
Open
rastislavs wants to merge 1 commit into
Open
Conversation
Resolve each peer's configured TCP-AO keychain when the peer is added, keep a reference on the FSM, and install or remove its keys on listening and connected sockets. Passive peers have all configured keys installed on matching listening sockets before the peer starts; no key is selected on the listener. Once an inbound connection is accepted and matched to the peer, select the configured send key as both CurrentKey and RNextKey before passing the connection to the FSM. Active peers install all keys from net.Dialer.Control before connect and mark the preferred key during installation, so the initial SYN uses it. Attaching, removing, or changing a keychain always uses the existing peer delete-and-add path and therefore restarts the session. A send ID change within the same keychain is handled live by updating RNext on the current connection. Management operations serialize peer and keychain changes. Socket key material is copied and cleared after use. Listener updates use their raw socket handles directly; existing connection updates hold the FSM mutex while reading fsm.conn and issuing the socket options, avoiding a select-then-use window in this path. Keychain key additions and deletions update the in-memory keychain first, then propagate to listeners and established connections. Per-socket failures are logged rather than rolling back the request, so propagation is best effort and can be partial. Users can use state data retrieval to confirm keychain changes have sucesfully propagated to all affected peers.
rastislavs
marked this pull request as ready for review
September 2, 2026 07:34
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.
Part of TCP-AO implementation (#3493) this PR actually applies configured TCP-AO keys to peer sockets and makes TCP-AO work end-to-end.
Dynamic peers are not yet supported, will be covered in a later PR.