Skip to content

fix(daemon): finish setup_protocol before multiplexing refuse-options error - #5734

Merged
oferchen merged 1 commit into
masterfrom
fix/daemon-refuse-mux-tag
Jun 12, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/daemon-refuse-mux-tag

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Mirror upstream rsync's clientserver.c:1146-1186 setup-protocol prelude on the daemon's post-@RSYNCD: OK refused-options abort path so the client decodes the multiplexed error frames at the right wire offset.
  • Drop a wire-level regression test (run_daemon_post_ok_refused_option_uses_multiplexed_error) that pins the byte stream byte-for-byte and rejects the historical unexpected tag 72 [Receiver] failure mode by name.

Why

Upstream's daemon, once it has emitted @RSYNCD: OK, runs setup_protocol() (compat-flags varint + checksum seed) before flipping to multiplexed output and writing any error. Our daemon skipped that prelude entirely on the refused-options abort path. The client then read our MSG_ERROR_XFER header bytes as the compat-flags varint and the next four bytes as the checksum seed before flipping to multiplex input. Framing resynced partway into the @ERROR: The server is configured to refuse --compress payload, decoding the letter A (ASCII 65) as a fresh multiplex tag and aborting with unexpected tag 72 [Receiver] against upstream rsync 3.4.3 and 3.4.4 — exactly the failure mode reported by the upstream daemon-refuse-compress testsuite check (and any sibling daemon-refuse cases triggered by packed bundles like -vlogDtprez.iLsfxCIvu).

The fix advertises a minimal compat-flag set without CF_VARINT_FLIST_FLAGS so the client's do_negotiated_strings stays clear and we do not have to write the bidirectional vstring exchange we have no peer for on the abort path.

Test plan

  • cargo fmt --all -- --check
  • cargo nextest run -p daemon -E 'test(run_daemon_post_ok_refused_option_uses_multiplexed_error) or test(run_daemon_refuses_disallowed_module_options)' (both green; latter exercises the existing pre-@RSYNCD: OK refuse path to confirm no regression)
  • Full nextest matrix via CI

… error

upstream rsync's daemon, after `@RSYNCD: OK`, completes `setup_protocol()`
(compat-flags varint + checksum seed) before flipping its writer to
multiplexed output and emitting any post-OK error. Refused-options
diagnostics that surface from `parse_arguments()` follow the same
discipline, riding `MSG_ERROR_XFER` + `MSG_ERROR_EXIT` frames.

Our daemon skipped that prelude entirely on the refused-options abort
path. The client then read the daemon's `MSG_ERROR_XFER` header as the
compat-flags varint and the next four bytes as the checksum seed before
flipping to multiplex input. The framing resynced partway into our
`@ERROR: The server is configured to refuse --compress` payload,
decoding the letter `A` (ASCII 65) as a fresh multiplex tag and aborting
with `unexpected tag 72 [Receiver]` against upstream 3.4.3 and 3.4.4.

Mirror the upstream prefix on the daemon side: write the compat-flags
varint (deliberately omitting `CF_VARINT_FLIST_FLAGS` so the client
never tries to read negotiated vstrings we have no peer for on the
abort path) followed by the 4-byte checksum seed, then emit the
existing multiplex frames. Add a wire-level regression test that pins
the byte stream to the upstream shape and rejects the historical
`tag 72` regression by name.
@github-actions github-actions Bot added the bug Something isn't working label Jun 12, 2026
@oferchen
oferchen merged commit e363cdd into master Jun 12, 2026
58 of 69 checks passed
@oferchen
oferchen deleted the fix/daemon-refuse-mux-tag branch June 12, 2026 05:32
oferchen added a commit that referenced this pull request Aug 24, 2026
… error (#5734)

upstream rsync's daemon, after `@RSYNCD: OK`, completes `setup_protocol()`
(compat-flags varint + checksum seed) before flipping its writer to
multiplexed output and emitting any post-OK error. Refused-options
diagnostics that surface from `parse_arguments()` follow the same
discipline, riding `MSG_ERROR_XFER` + `MSG_ERROR_EXIT` frames.

Our daemon skipped that prelude entirely on the refused-options abort
path. The client then read the daemon's `MSG_ERROR_XFER` header as the
compat-flags varint and the next four bytes as the checksum seed before
flipping to multiplex input. The framing resynced partway into our
`@ERROR: The server is configured to refuse --compress` payload,
decoding the letter `A` (ASCII 65) as a fresh multiplex tag and aborting
with `unexpected tag 72 [Receiver]` against upstream 3.4.3 and 3.4.4.

Mirror the upstream prefix on the daemon side: write the compat-flags
varint (deliberately omitting `CF_VARINT_FLIST_FLAGS` so the client
never tries to read negotiated vstrings we have no peer for on the
abort path) followed by the 4-byte checksum seed, then emit the
existing multiplex frames. Add a wire-level regression test that pins
the byte stream to the upstream shape and rejects the historical
`tag 72` regression by name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant