fix(cs2): allow p2p_id prefixes up to 8 bytes#2272
Open
weiwei0450 wants to merge 2 commits into
Open
Conversation
Adds DialCloud() for cs2 cameras of the MJA1-secure-element generation (c302n, cw701, hlc7) which never expose port 32108 on the LAN. When miss_get_vendor returns vendor=cs2 with a p2p_id, the miss client now runs a cloud-relay handshake against the Mi-Cloud relay (0x20/0xF9 followed by NAT-punching to the camera using info from the 0x40 reply) instead of the LAN handshake. Includes the CS2-Network P2P_Proprietary_Encrypt cipher used for the 0xF9 session auth. Resolves the "camera online but no video" symptom in AlexxIT#1982.
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.
Problem
Cameras with p2p_id prefixes longer than 6 bytes (e.g. xiaomi.camera.cw701) fail to connect via Mi-Cloud relay because the
buildP2PIDBlockfunction rejects prefixes > 6 bytes and the block copy only uses the first 6 bytes.Fix
> 6to> 8(line 149)block[0:6]toblock[0:8](line 162)This allows prefixes up to 8 bytes while staying within the 20-byte block layout (8 prefix + 2 pad + 4 num + 5 suffix + 1 pad = 20).
Testing
Verified with a xiaomi.camera.cw701 that has a 7-byte prefix. Cloud relay connection now succeeds.