auto_socket: модуль авто-управления сокетами при изменении сетевых интерфейсов + fix pre-existing ASAN-багов

- auto_socket.c/h: создание/удаление UDP сокетов автоматически при изменении интерфейсов через netlink/route socket
  При auto_sockets=yes пропускает ручные [server] сокеты
  Тип сокета: PUBLIC если публичный IP, иначе NAT
  Для новых сокетов добавляются линки ко всем активным NCD-соединениям
  При удалении интерфейса линки убираются, сокет закрывается
  Platform-agnostic API для использования из Android/chatgui

- node_conn_direct.h/c: ncd_add_socket_links / ncd_remove_socket_links — управление линками на конкретном сокете

- socket_monitor.h/c: экспорт socket_monitor_update_if_addr для auto_socket

- config_parser.h/c: опция auto_sockets в [global]

- init_sockets(): пропуск ручных сокетов при auto_sockets=yes

- utun_instance: интеграция auto_socket_init/destroy

- media_delivery: fix stack-buffer-overflow ack[3] → ack[9]

- topo_node: fix heap-use-after-free в topo_group_update_my_nodeinfo — сохранение node_id/ver перед registry_store, использование return value
This commit is contained in:
evgeny committed 2026-08-05 23:09:59 +03:00
1 parent a0ba6dee21
commit ef637d33a6
15 files changed
+789 -6

No files matched your search

+3
View File
@@ -20,6 +20,7 @@
#include "control_server.h"
#include "transport_layer/node_conn_direct.h"
#include "transport_layer/socket_monitor.h"
#include "transport_layer/auto_socket.h"
#include "../lib/u_async.h"
#include "../lib/debug_config.h"
@@ -219,6 +220,7 @@ static int instance_init_common(struct UTUN_INSTANCE* instance, struct UASYNC* u
}
socket_monitor_init(instance);
auto_socket_init(instance);
// conn_mgr initialized inside topo_group_create (via topo_groups_init)
@@ -434,6 +436,7 @@ void utun_instance_destroy(struct UTUN_INSTANCE *instance) {
instance->config_conn_handles = NULL;
socket_monitor_destroy(instance);
auto_socket_destroy(instance);
// Cleanup BGP module BEFORE sockets (needs live conn_mgr for recovery cleanup)
if (instance->topo_groups) {