Fix GSSAPI PUB/SUB subscription corruption on reconnection#4848
Open
jake-scott wants to merge 1 commit intozeromq:masterfrom
Open
Fix GSSAPI PUB/SUB subscription corruption on reconnection#4848jake-scott wants to merge 1 commit intozeromq:masterfrom
jake-scott wants to merge 1 commit intozeromq:masterfrom
Conversation
Problem: When GSSAPI encryption is active, subscribe and cancel message flags (msg_t::subscribe = 12, msg_t::cancel = 16) were not preserved through the encode_message/decode_message round-trip. encode_message() only captured the 'more' (bit 0) and 'command' (bit 1) flags in the wire flags byte. The subscribe flag occupies bits 2-3 (value 12) and cancel occupies bit 4 (value 16) — both outside the captured range, so they were silently zeroed on decoding. After decode_message(), xpub_t::xread_activated() would not recognise the arriving message as a subscribe or cancel command, causing subscriptions to be silently dropped after reconnection (when xhiccuped() re-sends cached subscriptions through the GSSAPI path). Solution: Encode the subscribe flag into wire bit 2 (0x04) and the cancel flag into wire bit 3 (0x08) in encode_message(), and restore them via set_flags(msg_t::subscribe) / set_flags(msg_t::cancel) in decode_message().
Author
|
This patch appears to solve the issue (help from Claude) |
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.
Fixes #4847
Problem: When GSSAPI encryption is active, subscribe and cancel message flags (msg_t::subscribe = 12, msg_t::cancel = 16) were not preserved through the encode_message/decode_message round-trip.
encode_message() only captured the 'more' (bit 0) and 'command' (bit 1) flags in the wire flags byte. The subscribe flag occupies bits 2-3 (value 12) and cancel occupies bit 4 (value 16) — both outside the captured range, so they were silently zeroed on decoding.
After decode_message(), xpub_t::xread_activated() would not recognise the arriving message as a subscribe or cancel command, causing subscriptions to be silently dropped after reconnection (when xhiccuped() re-sends cached subscriptions through the GSSAPI path).
Solution: Encode the subscribe flag into wire bit 2 (0x04) and the cancel flag into wire bit 3 (0x08) in encode_message(), and restore them via set_flags(msg_t::subscribe) / set_flags(msg_t::cancel) in decode_message().