Skip to content

fix(cs2): allow p2p_id prefixes up to 8 bytes#2272

Open
weiwei0450 wants to merge 2 commits into
AlexxIT:masterfrom
weiwei0450:feature/cs2-cloud-relay
Open

fix(cs2): allow p2p_id prefixes up to 8 bytes#2272
weiwei0450 wants to merge 2 commits into
AlexxIT:masterfrom
weiwei0450:feature/cs2-cloud-relay

Conversation

@weiwei0450

Copy link
Copy Markdown

Problem

Cameras with p2p_id prefixes longer than 6 bytes (e.g. xiaomi.camera.cw701) fail to connect via Mi-Cloud relay because the buildP2PIDBlock function rejects prefixes > 6 bytes and the block copy only uses the first 6 bytes.

Fix

  • Bump prefix length check from > 6 to > 8 (line 149)
  • Bump block copy slice from block[0:6] to block[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.

glissmam and others added 2 commits May 17, 2026 16:48
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants