From d67fc08ed57fedfec58fab236cd81e4acfa6a3e5 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Mon, 10 Nov 2025 01:46:05 -0500 Subject: [PATCH] fix: update sendPing to include source ID and HMAC verification hash for improved packet integrity --- src/OverteClient.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/OverteClient.cpp b/src/OverteClient.cpp index 6908660..882abb8 100644 --- a/src/OverteClient.cpp +++ b/src/OverteClient.cpp @@ -1541,13 +1541,10 @@ void OverteClient::sendPing(int fd, const sockaddr_storage& addr, socklen_t addr // Create NLPacket for Ping with correct version NLPacket packet(PacketType::Ping, PacketVersions::Ping_IncludeConnectionID, false); - // EXPERIMENTAL: Try sending as non-sourced packet to avoid hash verification issues - // The server should still be able to identify us from our source socket address - // if (m_localID != 0) { - // packet.setSourceID(m_localID); - // } - - // Set sequence number + // Set source ID and sequence number + if (m_localID != 0) { + packet.setSourceID(m_localID); + } packet.setSequenceNumber(m_sequenceNumber++); // Add timestamp (microseconds since epoch) @@ -1558,6 +1555,10 @@ void OverteClient::sendPing(int fd, const sockaddr_storage& addr, socklen_t addr // Ping type (0 = local, 1 = public) packet.writeUInt8(0); + // Write HMAC verification hash using null UUID as key + uint8_t nullUUID[16] = {0}; + packet.writeVerificationHash(nullUUID); + const auto& data = packet.getData(); // Debug: show destination address