Trace the first UDP contacts that affect cold NAT classification

This commit is contained in:
evgeny committed 2026-10-12 19:17:06 +02:00
1 parent 8906e29102
commit f71e94c9d8
2 files changed
+10 -2

No files matched your search

+7
View File
@@ -384,6 +384,13 @@ void nat_detection_note_send(struct NAT_DETECTION *detector, struct ETCP_SOCKET
uint8_t local[ROUTE_ADDR_WIRE_SIZE], remote[ROUTE_ADDR_WIRE_SIZE];
if (route_ping_addr_encode(local, &state->local) || route_ping_addr_encode(remote, destination)) return;
for (unsigned i = 0; i < state->contact_count; i++) if (!memcmp(state->contacts[i], remote, 17)) return;
DEBUG_DEBUG(DEBUG_CATEGORY_NAT, "NAT first UDP contact node=%016llx socket=%s id=%u generation=%016llx phase=%u group=%016llx"
" round=%016llx destination=%s reserved=%u cold_remaining_tb=%llu",
(unsigned long long)detector->instance->node_id, socket->name, socket->sock_id,
(unsigned long long)socket->generation, state->phase, (unsigned long long)state->group_id,
(unsigned long long)state->round, sockaddr_storage_to_str(destination).str,
state->reservation_fingerprint != 0,
(unsigned long long)(state->cold_until > get_time_tb() ? state->cold_until - get_time_tb() : 0));
if (state->contact_count == NAT_MAX_CONTACTS) {
if (state->history_complete) DEBUG_WARN(DEBUG_CATEGORY_NAT, "NAT contact history full socket=%s", socket->name);
if (!state->history_incomplete) history_mark_incomplete(state);