Repository navigation
AirPlay: raise on pair-setup error TLVs instead of hanging at SETUP - #2920
Open
marlow-systems wants to merge 1 commit into
Open
marlow-systems wants to merge 1 commit into
marlow-systems wants to merge 1 commit into
Conversation
The device answers pair-setup M3 with 200 OK even when it rejects the proof (Error=2 plus BackOff). Transient pairing never read that reply, so encryption was enabled with keys the device never derived and the next RTSP SETUP went unanswered until a 10 s timeout. Retries during the back-off then failed in M2 with KeyError: TlvValue.Salt. Check the error TLV on the M2/M4 replies (transient) and M2/M4/M6 (normal pair-setup) and raise AuthenticationError with the step, the error code and the back-off delay. Relates to postlund#2908.
This branch has not been deployed
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.
pyatv doesn't read the device's reply to pair-setup M3 in transient pairing (
AirPlayHapTransientPairVerifyProcedure). When the device rejects the proof, it still answers200 OK, withError=2and aBackOffTLV. pyatv then turns on encryption with keys the device never derived, so the next RTSPSETUPis never answered and times out after 10 s. A retry during the back-off fails in M2 withKeyError: TlvValue.Salt. HomePods on OS 27 show this (#2908).Changes:
hap_transient: a newcheck_pairing_error()runs on the M2 and M4 replies. It raisesAuthenticationErrornaming the step, the error code and, when the device sends one, the back-off delay.hap(normal pair-setup): the same check on the M2, M4 and M6 replies.Tested against a HomePod (AudioAccessory6,1, OS 27.0). Streaming used to hang about 10 s at
SETUP. It now fails in 0.3 s withpair-setup M4 rejected by device (error 2, retry after 4s). Full test suite passes (1250 passed), and flake8 and black are clean.This doesn't fix the underlying OS 27 rejection; see #2908.
— Marlow