Browse Source

correct source connection id for HolePunch

pull/1769/head
orignal 2 years ago
parent
commit
b8bc114502
  1. 4
      libi2pd/SSU2Session.cpp

4
libi2pd/SSU2Session.cpp

@ -842,14 +842,14 @@ namespace transport
Header header; Header header;
uint8_t h[32], payload[SSU2_MAX_PAYLOAD_SIZE]; uint8_t h[32], payload[SSU2_MAX_PAYLOAD_SIZE];
// fill packet // fill packet
header.h.connID = ((uint64_t)htobe32 (nonce) << 32) | htobe32 (nonce); // dest id header.h.connID = htobe64 (((uint64_t)nonce << 32) | nonce); // dest id
RAND_bytes (header.buf + 8, 4); // random packet num RAND_bytes (header.buf + 8, 4); // random packet num
header.h.type = eSSU2HolePunch; header.h.type = eSSU2HolePunch;
header.h.flags[0] = 2; // ver header.h.flags[0] = 2; // ver
header.h.flags[1] = (uint8_t)i2p::context.GetNetID (); // netID header.h.flags[1] = (uint8_t)i2p::context.GetNetID (); // netID
header.h.flags[2] = 0; // flag header.h.flags[2] = 0; // flag
memcpy (h, header.buf, 16); memcpy (h, header.buf, 16);
uint64_t c = !header.h.connID; uint64_t c = ~header.h.connID;
memcpy (h + 16, &c, 8); // source id memcpy (h + 16, &c, 8); // source id
RAND_bytes (h + 24, 8); // token RAND_bytes (h + 24, 8); // token
// payload // payload

Loading…
Cancel
Save