evgeny
ec51b2d61f
Version signed node snapshots with persistent timestamps
5 days ago
evgeny
38c9f229bc
stcp: ed25519 pubkey exchange in handshake, fix instance destroy segfault, fix chat_tcp_test
...
- u_async.c: process immediate_queue BEFORE epoll_wait in uasync_poll
- stcp_link.c: defensive NULL etcp_conn/etcp_link in stcp_link_close
- utun_instance.c: move stcp_server_list_destroy_all to Phase J (before ETCP),
add deferred drain in both Phase J and L
- stcp.h/c: STCP_HS_ENC_CLIENT 6→38, STCP_HS_ENC_SERVER 7→39,
exchange ed25519_pubkey in both handshake directions
- etcp_connections.c: copy peer_ed25519 from STCP to ETCP_CONN in
etcp_link_enter_ready_tcp; guard link->etcp in tcp_link_close_cb
- chat_sync.c: fix lk->conn NULL dereference for TCP links
- test_stcp.c: update stcp_server_create/stcp_client_connect callsites
- tools/chat_tcp_test: change transport udp→tcp
2 months ago
evgeny
a3783b5f55
fix: re-index conn_queue_entry after setting peer_node_id
...
tcp_server_on_link sets conn->peer_node_id after etcp_connection_create
which adds the entry with peer_node_id=0. instance_find_conn couldnt
find TCP connections until the queue entry was re-indexed.
2 months ago
evgeny
adac854c94
fix: TCP data flow — tx_state, keepalive, last_recv_local_time
...
- etcp_link_enter_ready_tcp: set tx_state=DATA_WAIT (was 0, blocking sends)
- etcp_conn_input: update last_recv_local_time on every packet (keepalive liveness)
- link_rx_cb: handle ETCP_KEEPALIVE before etcp_conn_input (conflicts with MEAS_RESP=0x08)
- KEEPALIVE handler: set recv_keepalive, remote_keepalive, link_status, keepalive_recv_count
- test_stcp_traffic: etcp_send instead of raw stcp_link_send
- test_etcp_stcp: rewrite for utun_instance + etcp_connect
2 months ago
evgeny
d773f1724a
refactor: STCP connections as ETCP links (is_tcp)
...
- Add is_tcp, tcp_link, tcp_reconnect_* fields to ETCP_LINK
- Remove transport_link from ETCP_CONN, add tcp_link_count
- stcp_link: replace embedded etcp_conn with pointer; add etcp_link backpointer
- stcp_link: link_rx_cb routes ETCP data to etcp_conn_input
- stcp_link: call on_close_cb in close
- New TCP functions: etcp_link_enter_ready_tcp, etcp_tcp_link_start_connect,
etcp_tcp_link_start_reconnect, tcp_link_close_cb, etcp_tcp_send
- etcp_link_new: handle NULL conn for TCP links; skip enter_init for TCP
- etcp_link_close: close stcp_link for TCP
- etcp_encrypt_send: redirect TCP to etcp_tcp_send (skips AES-CCM)
- tcp_server_on_link: create ETCP_LINK(is_tcp=1) + enter_ready_tcp
- etcp_connect: TCP addrs -> etcp_tcp_link_start_connect
- Remove ctx->tcp_link/tcp_ready
- test_stcp_traffic: find stcp_link via links->is_tcp instead of transport_link
- 66/68 tests pass; 2 STCP tests expected to fail (integration not complete)
2 months ago
evgeny
d310bccf08
fix: memory pool alloc mismatch in tests, db_sync SEND_DATA buffer overflow
...
- test_etcp_router_reconnect, test_etcp_connect, test_stcp_traffic:
replace u_calloc with memory_pool_alloc for TOPO_SOCKMETA4/TOPO_ADDR4
- db_sync.c: fix req[14] -> req[15] — SEND_DATA request header is 15 bytes
(type:1 + from:4 + count:2 + vp:4 + want_from:4)
2 months ago
Evgeny
fcf3fb7f51
refactor: move transport (etcp/stcp/normalizer) to transport_layer/, routing (bgp/pings/topo*) to routing_layer/
2 months ago
Evgeny
a7ecee01f5
etcp: replace connections linked-list with indexed ll_queue, add state/ref_count lifecycle
...
- Remove ETCP_CONN.next linked-list, UTUN_INSTANCE.connections list/count
- Unified connections in single ll_queue indexed by peer_node_id (0=pending)
- struct conn_queue_entry { peer_node_id, conn* } for uniform queue data
- Connection lifecycle via etcp.c: create→pending, conn_ready→indexed, close→detach+deferred free
- Close split: phase1 detach from external world, phase2 deferred via uasync_call_soon
- etcp_conn_set_peer_node_id: reindex on ID change (WARN)
- etcp_conn_ref_take/free: blocking close until refcount returns to 0
- Remove chat_connections — use unified connections queue directly
- Update all iteration/search patterns across 40 files (src + tests + chatgui)
3 months ago
Evgeny
28e5950d29
TOPO_BGP -> TOPO_GROUP: multi-group support
...
- Renamed TOPO_BGP to TOPO_GROUP with topo_group_id (64bit)
- Added TOPO_GROUPS container (ll_queue group_list) in UTUN_INSTANCE
- Memory pools moved from TOPO_GROUP to TOPO_GROUPS (instance-level)
- Default group: TOPO_GROUP_UTUN = 0x8000000000000000
- topo_groups_get_default() searches by group_id, not just first entry
- All topo_bgp_* renamed to topo_group_*; function signatures updated
- Files: topo_bgp.h/c -> topo_group.h/c
3 months ago
Evgeny
3c3d9a65d9
refactor: переименование route_node/route_bgp в topo_node/topo_bgp
...
Файлы: route_node.* route_node_lmdb.* route_bgp.* -> topo_node.* topo_node_lmdb.* topo_bgp.*
Структуры:
- ROUTE_BGP -> TOPO_BGP, ROUTE_BGP_CONN_ITEM -> TOPO_BGP_CONN_ITEM
- NODEINFO -> TOPO_NODE, NODEINFO_Q -> TOPO_NODEQ, NODEINFO_PATH -> TOPO_NODEPATH
- NODEINFO_ROUTES -> TOPO_NODESUBNETS, NODE_CONNECTIVITY -> TOPO_CONNECTIVITY
- wire: NODEINFO_MSG -> TOPOMSG_NODE, NODEINFO_IPV4_* -> TOPOMSG_*4 и т.д.
- memory: NI_IPV4_* -> TOPO_*4, NI_IPV6_* -> TOPO_*6
- ROUTE_SUBCMD_* -> TOPO_SUBCMD_*, ETCP_ID_ROUTE_ENTRY -> ETCP_ID_TOPO_ENTRY
Функции:
- route_bgp_* -> topo_bgp_*
- nodeinfo_* -> topo_node_*
- route_node_* -> topo_node_*
- route_node_lmdb_* -> topo_node_lmdb_*
Смысл: отделение механизма формирования топологии узлов от IP-роутинга.
3 months ago
Evgeny
90ad64a106
stcp: add protocol field to NODEINFO addr structs, TCP support in etcp_connect, stcp traffic test
...
- route_node.h: add NODE_PROTO_UDP/NODE_PROTO_TCP constants, protocol field in NODEINFO_IPV4_ADDR/NODEINFO_IPV6_ADDR
- route_node.c: fill protocol for UDP sockets + TCP servers from config, update dumps
- etcp_connect.c: create stcp_link for TCP-capable addresses, ready/close callbacks, cleanup
- etcp_connections.c: store stcp_server_listen result in instance->stcp_server, fix socket init checks for TCP-only configs
- utun_instance.c: use stcp_link_server_destroy (high-level API) instead of stcp_server_destroy
- tests/test_stcp_traffic.c: 2 nodes via etcp_connect+TCP, 1MB bidirectional traffic (10-1800 byte pkts)
3 months ago