summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-10-17 18:03:34 +0200
committerDirk Engling <erdgeist@erdgeist.org>2026-10-17 18:03:34 +0200
commit4a143ded7ab67d1707241bf9028524cec3532fe4 (patch)
tree9a1d96262d3c35414768973bda696e347c3f3f40
parente51780b5bdac4e667fa1945bfa6085b7dcd940ae (diff)
Expand live synced v4 addresses before feeding them to peer list
-rw-r--r--ot_livesync.c10
1 files changed, 9 insertions, 1 deletions
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) {
136static void livesync_handle_peersync(struct ot_workstruct *ws, size_t peer_size) { 136static void livesync_handle_peersync(struct ot_workstruct *ws, size_t peer_size) {
137 size_t off = sizeof(g_tracker_id) + sizeof(uint32_t); 137 size_t off = sizeof(g_tracker_id) + sizeof(uint32_t);
138 138
139 /* Prepare peer record for v4mapped expansion */
140 if (peer_size == OT_PEER_SIZE4)
141 memcpy(&ws->peer, V4mappedprefix, sizeof(V4mappedprefix));
142
139 /* Now basic sanity checks have been done on the live sync packet 143 /* Now basic sanity checks have been done on the live sync packet
140 We might add more testing and logging. */ 144 We might add more testing and logging. */
141 while ((ssize_t)(off + sizeof(ot_hash) + peer_size) <= ws->request_size) { 145 while ((ssize_t)(off + sizeof(ot_hash) + peer_size) <= ws->request_size) {
142 memcpy(&ws->peer, ws->request + off + sizeof(ot_hash), peer_size); 146 uint8_t *peer_ip = ws->request + off + sizeof(ot_hash);
147 if (peer_size == OT_PEER_SIZE4)
148 memcpy(&ws->peer + sizeof(V4mappedprefix), peer_ip, peer_size);
149 else
150 memcpy(&ws->peer, peer_ip, peer_size);
143 ws->hash = (ot_hash *)(ws->request + off); 151 ws->hash = (ot_hash *)(ws->request + off);
144 152
145 if (!g_opentracker_running) 153 if (!g_opentracker_running)