Remove peer admission policy from shared ETCP connections

This commit is contained in:
evgeny committed 2026-10-30 22:49:59 +01:00
1 parent b295557e0b
commit 816807842c
2 files changed
+2 -13

No files matched your search

+1 -10
View File
@@ -156,7 +156,7 @@ static void etcp_down_timer_cancel(struct ETCP_CONN* conn) {
conn->log_name, conn->links_up, conn->close_requested);
}
struct ETCP_CONN* etcp_connection_create(struct UTUN_INSTANCE* instance, char* name, int require_known_node) {
struct ETCP_CONN* etcp_connection_create(struct UTUN_INSTANCE* instance, char* name) {
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "");
if (!instance) return NULL;
@@ -168,7 +168,6 @@ struct ETCP_CONN* etcp_connection_create(struct UTUN_INSTANCE* instance, char* n
}
etcp->instance = instance;
etcp->require_known_node = !!require_known_node;
etcp->input_queue = queue_new(instance->ua, 0, 0, 0, "ETCP input"); // No hash for input_queue
queue_set_threshold(etcp->input_queue, 0, 0); // Backpressure: ждать полного освобождения
etcp->output_queue = queue_new(instance->ua, 0, 0, 0, "ETCP output"); // No hash for output_queue
@@ -618,14 +617,6 @@ void etcp_conn_ready(struct ETCP_CONN* conn) {
if (!conn || conn->close_requested) return;
if (conn->state == 2) { DEBUG_WARN(DEBUG_CATEGORY_ETCP, "[%s] conn_ready on deleted conn", conn->log_name); return; }
if (conn->initialized || conn->session_required) return; // ready or awaiting authenticated confirmation
if (conn->require_known_node) {
int admitted = 0;
for (struct ETCP_LINK* link = conn->links; link; link = link->next)
if (link->initialized && (!link->require_known_node || link->peer_admitted)) { admitted = 1; break; }
if (!admitted) {
DEBUG_WARN(DEBUG_CATEGORY_ETCP, "[%s] ready denied: no authenticated admitted path", conn->log_name); return;
}
}
conn->initialized = 1;
conn->reset_done = 1;
+1 -3
View File
@@ -139,7 +139,6 @@ struct ETCP_CONN {
// Peer info
uint64_t peer_node_id; // Peer node ID
uint8_t require_known_node; // Начальная политика пакетных драйверов; сокетные пути UTUN остаются без требования CHAT-членства.
uint8_t peer_ed25519_pubkey[SC_PUBKEY_SIZE]; // Ed25519 pubkey пира (из INIT)
uint8_t peer_sleep_phase; // 1 = пир в SLEEP-фазе (троттлить), 0 = ACTIVE-окно (обмен)
uint16_t peer_active_remaining; // до SLEEP-фазы (x0.1с), из keepalive
@@ -268,10 +267,9 @@ struct ETCP_CONN {
#define RTT_CB_PERIOD_TB 600000 // 1 минута в 0.1ms
/* Создать транспортный объект в instance, name копируется (может быть NULL).
* require_known_node=1 задаёт проверку известного ключа новым пакетным драйверам; сокетные пути UTUN не наследуют её.
* Жизненным циклом прикладного соединения управляет NCD. Возвращает объект либо NULL при ошибке/отмене из callback.
* New-connection/NEW callbacks могут закрыть объект; после отмены конструктор завершает закрытие и не возвращает handle. */
struct ETCP_CONN* etcp_connection_create(struct UTUN_INSTANCE* instance, char* name, int require_known_node);
struct ETCP_CONN* etcp_connection_create(struct UTUN_INSTANCE* instance, char* name);
#define ETCP_DOWN_TIMEOUT_TB 300000 /* 30 секунд в 0.1 ms */