From 4a143ded7ab67d1707241bf9028524cec3532fe4 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 17 Oct 2026 18:03:34 +0200 Subject: Expand live synced v4 addresses before feeding them to peer list --- ot_livesync.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ot_livesync.c b/ot_livesync.c index 269b8d8..fbedb73 100644 --- a/ot_livesync.c +++ b/ot_livesync.c @@ -136,10 +136,18 @@ static void livesync_issue_peersync(sync_buffer *buf) { static void livesync_handle_peersync(struct ot_workstruct *ws, size_t peer_size) { size_t off = sizeof(g_tracker_id) + sizeof(uint32_t); + /* Prepare peer record for v4mapped expansion */ + if (peer_size == OT_PEER_SIZE4) + memcpy(&ws->peer, V4mappedprefix, sizeof(V4mappedprefix)); + /* Now basic sanity checks have been done on the live sync packet We might add more testing and logging. */ while ((ssize_t)(off + sizeof(ot_hash) + peer_size) <= ws->request_size) { - memcpy(&ws->peer, ws->request + off + sizeof(ot_hash), peer_size); + uint8_t *peer_ip = ws->request + off + sizeof(ot_hash); + if (peer_size == OT_PEER_SIZE4) + memcpy(&ws->peer + sizeof(V4mappedprefix), peer_ip, peer_size); + else + memcpy(&ws->peer, peer_ip, peer_size); ws->hash = (ot_hash *)(ws->request + off); if (!g_opentracker_running) -- cgit v1.3