From b8bc1145021bc36dd4f4e7b3262065abb0ca1acc Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 20 Jun 2022 15:52:16 -0400 Subject: [PATCH] correct source connection id for HolePunch --- libi2pd/SSU2Session.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libi2pd/SSU2Session.cpp b/libi2pd/SSU2Session.cpp index ddfe904f..57a273ca 100644 --- a/libi2pd/SSU2Session.cpp +++ b/libi2pd/SSU2Session.cpp @@ -842,14 +842,14 @@ namespace transport Header header; uint8_t h[32], payload[SSU2_MAX_PAYLOAD_SIZE]; // 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 header.h.type = eSSU2HolePunch; header.h.flags[0] = 2; // ver header.h.flags[1] = (uint8_t)i2p::context.GetNetID (); // netID header.h.flags[2] = 0; // flag memcpy (h, header.buf, 16); - uint64_t c = !header.h.connID; + uint64_t c = ~header.h.connID; memcpy (h + 16, &c, 8); // source id RAND_bytes (h + 24, 8); // token // payload