diff --git a/src/routing_layer/nat_detection.c b/src/routing_layer/nat_detection.c index 1bbddbe4..81c5632c 100644 --- a/src/routing_layer/nat_detection.c +++ b/src/routing_layer/nat_detection.c @@ -1204,6 +1204,9 @@ static uint64_t candidate_fingerprint(struct nat_socket *state, int ready) { group_total += hash; } if (ready || (candidates >= 2 && observers)) total += group_total; + if (!ready) DEBUG_DEBUG(DEBUG_CATEGORY_NAT, "NAT cold group candidates node=%016llx socket=%s group=%016llx candidates=%u observers=%u", + (unsigned long long)detector->instance->node_id, state->socket->name, + (unsigned long long)group->group_id, candidates, observers); } return total; } @@ -1221,6 +1224,9 @@ uint64_t nat_detection_probe_delay(struct NAT_DETECTION *detector) { if (!state) continue; uint64_t fingerprint = candidate_fingerprint(state, 0); if (fingerprint != state->reservation_fingerprint) { + DEBUG_DEBUG(DEBUG_CATEGORY_NAT, "NAT cold reservation node=%016llx socket=%s previous=%016llx current=%016llx", + (unsigned long long)detector->instance->node_id, socket->name, + (unsigned long long)state->reservation_fingerprint, (unsigned long long)fingerprint); state->reservation_fingerprint = fingerprint; if (fingerprint) state->cold_until = now + NAT_ROUND_TB + 2500; } diff --git a/tests/test_nat_detection.c b/tests/test_nat_detection.c index 3b3bf2e9..db430a6a 100644 --- a/tests/test_nat_detection.c +++ b/tests/test_nat_detection.c @@ -111,6 +111,7 @@ static void test_all_groups_tcp(void) { int main(void) { debug_config_init(); debug_set_level(DEBUG_LEVEL_WARN); debug_set_category_level(DEBUG_CATEGORY_NAT, DEBUG_LEVEL_DEBUG); + if (getenv("UTUN_TEST_DEBUG")) debug_set_category_level(DEBUG_CATEGORY_BGP, DEBUG_LEVEL_DEBUG); struct nat_fixture fixture; nat_fixture_init(&fixture); struct SC_MYKEYS first, second; assert(sc_generate_keypair(&first) == SC_OK && sc_generate_keypair(&second) == SC_OK);