Remove time-dependent profile matching from connection setup

This commit is contained in:
evgeny committed 2026-10-12 17:01:28 +02:00
1 parent f900cda9c0
commit e47ae480f5
2 files changed
+7 -14

No files matched your search

+3 -6
View File
@@ -102,14 +102,12 @@ uint8_t cm_classify_v6_addr(const uint8_t addr[16]) {
int cm_has_direct_ip(struct CONN_MGR* mgr, struct TOPO_GROUP_NODE* nq) {
struct TOPO_NODE* ni = nq ? topo_node_registry_find(mgr->instance->topo_groups, nq->node_id) : NULL;
if (!ni) return 0;
int64_t current = ntp_time_get_us(mgr->instance);
uint64_t now_us = current > 0 ? (uint64_t)current : 0;
for (const struct TOPO_ADDR4* a = ni->v4_addrs; a; a = a->next) {
if (!(a->protocol & (TOPO_PROTO_UDP | TOPO_PROTO_TCP))) 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;
uint8_t cls = sock_target_class(a->type, m->config_type, &m->address_profile, ip_is_public(ip), now_us);
uint8_t cls = sock_target_class(a->type, m->config_type, &m->address_profile, ip_is_public(ip));
if (cls != SOCK_TC_PRIV && cls != SOCK_TC_UNREACH) return 1;
if (a->type == TOPO_ADDR_INTERFACE && m->config_type == CFG_SERVER_TYPE_PUBLIC) return 1;
}
@@ -119,7 +117,7 @@ int cm_has_direct_ip(struct CONN_MGR* mgr, struct TOPO_GROUP_NODE* nq) {
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,
cm_classify_v6_addr(a->addr) == CM_V6_DIR, now_us);
cm_classify_v6_addr(a->addr) == CM_V6_DIR);
if (cls != SOCK_TC_PRIV && cls != SOCK_TC_UNREACH) return 1;
if (a->type == TOPO_ADDR_INTERFACE && meta->config_type == CFG_SERVER_TYPE_PUBLIC) return 1;
}
@@ -625,13 +623,12 @@ void cm_start_local_scan(struct CONN_MGR_ENTRY* entry) {
(unsigned long long)entry->node_id); return;
}
int addresses = 0;
int64_t current = ntp_time_get_us(entry->mgr->instance);
for (const struct TOPO_ADDR4* a = ni->v4_addrs; a; a = a->next) {
if (!(a->protocol & (TOPO_PROTO_UDP | TOPO_PROTO_TCP))) 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 && sock_target_class(a->type, m->config_type, &m->address_profile,
ip_is_public(ip), current > 0 ? (uint64_t)current : 0) == SOCK_TC_PRIV) {
ip_is_public(ip)) == SOCK_TC_PRIV) {
addresses++; break;
}
}