Ignore zero-port addresses in connection manager candidates

This commit is contained in:
evgeny committed 2026-10-25 21:01:03 +01:00
1 parent 539f09004c
commit fcc4a2cf42
1 file changed
+10
+10
View File
@@ -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,