From fcc4a2cf42542446c9b60b749469debfe3f683a4 Mon Sep 17 00:00:00 2001 From: evgeny Date: Sun, 25 Oct 2026 21:01:03 +0100 Subject: [PATCH] Ignore zero-port addresses in connection manager candidates --- src/routing_layer/conn_mgr_core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/routing_layer/conn_mgr_core.c b/src/routing_layer/conn_mgr_core.c index f19df4de..62a80443 100644 --- a/src/routing_layer/conn_mgr_core.c +++ b/src/routing_layer/conn_mgr_core.c @@ -110,6 +110,11 @@ int cm_has_direct_ip(struct CONN_MGR* mgr, struct TOPO_GROUP_NODE* nq) { if (!ni) return 0; for (const struct TOPO_ADDR4* a = ni->v4_addrs; a; a = a->next) { if (!(a->protocol & (TOPO_PROTO_UDP | TOPO_PROTO_TCP))) continue; + if (!a->port) { + DEBUG_DEBUG(DEBUG_CATEGORY_GENERAL, "conn_mgr: skip IPv4 candidate peer=%016llx socket=%u port=0", + (unsigned long long)nq->node_id, a->socket_id); + continue; + } uint32_t ip; memcpy(&ip, a->addr, 4); for (const struct TOPO_SOCKMETA4* m = ni->v4_sock_meta; m; m = m->next) { if (m->id != a->socket_id) continue; @@ -120,6 +125,11 @@ int cm_has_direct_ip(struct CONN_MGR* mgr, struct TOPO_GROUP_NODE* nq) { } for (const struct TOPO_ADDR6* a = ni->v6_addrs; a; a = a->next) { if (!(a->protocol & (TOPO_PROTO_UDP | TOPO_PROTO_TCP))) continue; + if (!a->port) { + DEBUG_DEBUG(DEBUG_CATEGORY_GENERAL, "conn_mgr: skip IPv6 candidate peer=%016llx socket=%u port=0", + (unsigned long long)nq->node_id, a->socket_id); + continue; + } for (const struct TOPO_SOCKMETA6 *meta = ni->v6_sock_meta; meta; meta = meta->next) { if (meta->id != a->socket_id) continue; uint8_t cls = sock_target_class(a->type, meta->config_type, &meta->address_profile,