summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)