Evgeny
2a259191b9
feat: queue_set_waiter_defer — immediate or call_soon callback mode
...
queue_waiter_handle stores defer_q/cb/arg, no extra malloc.
queue_set_waiter_defer(q, 1) enables call_soon dispatch for waiter callbacks.
bbr_integration uses it instead of manual send_waiter_cb wrapper.
4 months ago
Evgeny
331d43c6f7
fix: proxy ERROR loop, BBR test backpressure, O(1) u_free, test ordering
...
- tcp_proxy: ERROR silently dropped (no ERROR->ERROR loop), Russian removed from logs
- etcp_bbr: swap min(lo) and max(4*mss) in bbr_bound_cwnd_for_inflight_model
- test_etcp_bbr: fix cwnd comparison (packets vs bytes)
- ll_queue: double-put detection (abort), Floyd cycle detection in consistency check
- ll_queue: QUEUE_DEBUG commented out (was always-on, O(N) per put)
- mem: u_free_impl now O(1) via doubly-linked list, double-free detection
- bbr_integration: queue_waiter_wait + call_soon backpressure (threshold=1)
- tests/Makefile.am: fast tests first, *.log cleanup before run
4 months ago
Evgeny
fceec1aea6
fix: move debug logs before async operations (queue_put, timer_set, resume) for meaningful log ordering
4 months ago
Evgeny
4556f327c2
1
4 months ago
Evgeny
1f4fe37fe5
proxy: rename + simplify + backpressure
...
- tcp_proxy/remote_proxy → tcp_proxy_client/tcp_proxy_server
- Все proxy файлы перенесены в src/proxy/
- Конфиг: [tcp_proxy]→[tcp_proxy_client], [remote_proxy]→[tcp_proxy_server]
- Убран subcmd CONNECTED (0x02) — клиент шлёт DATA сразу после CONNECT
- Backpressure: etcp_router_waiter_register/cancel через ll_queue threshold waiter
- Клиент: recv_cb send fail → tx_buf+waiter, не tcp_recved() (окно lwIP=0)
- Сервер: read_cb send fail → pause_buf+waiter, пауза read_id
- CLOSE/ERROR отправляется только после drain всех очередей
- Fail: conn не найден/closed → send ERROR вместо CLOSE/silent drop
- PROTOCOL.md: полная архитектура с диаграммами состояний и потоков
4 months ago
Evgeny
ed6b4d1046
debug: выделить link keepalive в отдельную категорию KEEPALIVE (21), добавить DEBUG_DEBUG при приёме keepalive-пакета
4 months ago
Evgeny
4e6d57e371
clear freed memory in u_free_impl to catch UAF earlier
4 months ago
Evgeny
6521451493
disable BACKTRACE_ENABLED to fix lld linker error with backtrace symbols
4 months ago
Evgeny
7c71ef683c
add lwIP TCP stack test with fixes: rcv_wnd tracking, FIN compensation, tmr_phase dual-counter, trace ring buffer, stats counters
4 months ago
Evgeny
8994d7a834
update timeout_heap and u_async: O(1) cancel, heap cancel bubble-up fix, epoll callback safety, uasync_stop, socket_array u_realloc
4 months ago
Evgeny
4d5afe5ae9
fix uasync: posted_tasks delivery on Linux, create cleanup leaks, atomic array expand
5 months ago
Evgeny
1a4b0a9de6
fix stale pointer after realloc in uasync socket/event handlers
5 months ago
Evgeny
d0af315ff6
fix uasync set_timeout(0) ordering, dummynet shaper initial delay, add tests
...
- uasync_set_timeout(0): use FIFO immediate_queue instead of timeout_heap
to guarantee execution AFTER all currently-expired heap timers
- uasync_cancel_timeout: search immediate_queue for timeout=0 timers
- dummynet: start initial shaper with bandwidth-based delay instead of 0
(prevents queue from never filling up when packets arrive sequentially)
- test_dummynet: rename get_time_us -> now_us (conflict with u_async.h)
- test_u_async_comprehensive: fix immediate_timeouts, add timeout_ordering test
5 months ago
Evgeny
a0e5446790
migrate NAT and DATA to etcp_router, fix warnings and destroy order
5 months ago
Evgeny
c24a6367cc
add IPv6 default route interface auto-detection for permanent/temporary IPv6 without netif
...
- get_default_route_netif_index(): UDP connect trick + getifaddrs to find default route iface
- etcp_socket_add(): auto-detect netif_index when not specified in config
- queue_new() API: explicit index_offset/index_size params instead of implicit from hash_size
- radix: cleanup types (uint8_t*), replace bzero/bcmp with memset/memcmp, remove kernel ifdefs
- route6_lib: new IPv6 routing library + get_node_v6_routes()
5 months ago
Charlie Root
e1f051856f
radix
5 months ago
Evgeny
d0d4199273
etcp: unified send hook via etcp_udp_send, remove loss_rate, add dummynet_filter inline mode, rewrite BGP test
...
- Add etcp_udp_send_fn_t hook typedef, send_hook/send_hook_ctx fields to ETCP_LINK
- Implement etcp_udp_send() wrapper — all UDP sends go through one point
- Remove loss_rate from ETCP_SOCKET, CFG_SERVER, config parser, send path
- Add dummynet_filter: inline send-hook with loss/delay, no proxy socket needed
- Rewrite test_bgp_route_exchange: 3-node chain A(2 links)↔B↔C, 7 phases
with dummynet_filter-based link failure/recovery simulation
- Clean up tests: remove skeleton test_routing_mesh, 6 debug/stale test files
- Refactor test_etcp_simple_traffic and test_pkt_normalizer_etcp (remove debug spam)
- Fix test_etcp_two_instances: remove private field access, fix false PASS on timeout
5 months ago
Evgeny
61fee27478
congestion: burst-based BW measurement + adaptive inflight (slow start/cong avoidance/loss response)
...
New features:
- get_time_us() in lib/u_async.c/h for µs-precision timing
- Burst measurement (ETCP_SECTION_MEAS_TS 0x07, MEAS_RESP 0x08, FILLER 0x09)
- 12 MTU packets sent at line rate, receiver measures inter-packet gaps
- Burst triggered when link saturated + min 500ms interval
- Result: measured BW -> bandwidth for shaper, burst_target_bdp for window cap
- 3-phase adaptive inflight in link_stats_timer_cb:
- Slow start: windows doubles each RTT, exits on loss/RTT spike/threshold
- Congestion avoidance: additive increase, proportional RTT shrink, multiplicative loss shrink
- Burst target cap: inflight_lim <= burst_target_bdp * 1.1
- Dynamic optimal_inflight = sum(link->inflight_lim_bytes), recalculated on change
- Adaptive win_timebase = rtt/2 (was hardcoded 10ms)
Fixes:
- dummynet.c: shaper formula fixed (80000 -> 80)
- dummynet.c: queue_data_put call fixed (3 args -> 2)
- etcp.c: SIZE ERROR format string (missing log_name argument)
- etcp_request_pkt: FILLER leaves room for PAYLOAD overhead
Tests:
- test_etcp_congestion.c: single-threaded, 5-phase BW/delay/loss test
- sender + receiver + dummynet in one uasync
- CSV metrics output every 100ms
- All 29 existing tests pass
5 months ago
Evgeny
39544e6b2b
Fix: Add bounds/mtu checks, underflow protection and null deref fix for ETCP robustness
5 months ago
Evgeny
595d2b177b
Refactor: Replace custom tc_hton*/tc_ntoh* with standard htobe16/be16toh/htobe32/be32toh, move htobe16/be16toh to platform_compat.h
5 months ago
Evgeny
69b49d424b
Fix: Include platform_compat.h before winsock2.h in debug_config.h so tc_htonl/tc_htons macros are defined first
5 months ago
Evgeny
6284a95267
Fix: Define tc_htonl/tc_htons as macros before winsock2.h to avoid struct-in_addr redefinition
5 months ago
Evgeny
aafa0cfcab
Fix: Add portable tc_htonl/tc_htons/tc_ntohl/tc_ntohs macros, replace winsock2-incompatible hton*/nto* in NAT test files
5 months ago
Evgeny
907ef244c6
NAT: Full Cone (EIM) NAT with ETCP_ID_NAT protocol, per-node routing, and comprehensive test suite
...
- New ETCP protocol ETCP_ID_NAT (0x02) for NAT traffic between nodes
- eim_nat.c/h: Pure NAT engine (table, port allocation, checksum updates, egress/ingress)
- nat_transport.c/h: Transport layer (NAT TUN, ETCP binding, client/provider roles)
- route_bgp_find_conn_for_node(): shared utility for optimal connection lookup
- tun_init_nat(): dedicated TUN creation for NAT
- Config: [nat] section with tun_ip, port_start/end, nat_via, forward rules
- Fix: csum_update_ip/transport use htonl() halves (correct on LE systems)
- Fix: IP_FRAG_MF_MASK changed to 0x2000 (after ntohs, MF is bit 13)
- Tests: 26 engine unit + 4 transport integration + 7 stress (29 total)
5 months ago
Evgeny
45a181370f
Add htobe32/be32toh macros for Windows build
5 months ago
Evgeny
27df3355f1
Fix getmyip.h Windows build: use winsock2.h instead of sys/socket.h
5 months ago
Evgeny
6aedf5fe91
Replace buggy get_default_route_ip() with get_outgoing_local_ip() for reliable local IP detection
...
- Add lib/getmyip.c/h with get_outgoing_local_ip() using UDP connect+getsockname
- Update etcp_socket_add() to use new function for 0.0.0.0 and :: bindings
- Support both IPv4 (8.8.8.8) and IPv6 (2001:4860:4860::8888) auto-detection
- Remove broken get_default_route_ip() from platform_compat (it returned gateway IP, not local IP)
- Keep get_interface_ip_by_index() for explicit interface bindings
- Update Makefile.am to include new getmyip module
5 months ago
Evgeny
724a9ff5c7
Add getmyip module for reliable local IP detection
...
- New lib/getmyip.c/h with get_outgoing_ip(), get_default_local_ip(), get_local_ip_by_index()
- Uses UDP connect + getsockname instead of /proc/net/route parsing
- Supports both IPv4 and IPv6
- Updated etcp_socket_add() to use new functions for interface_addr detection
5 months ago
Evgeny
b466d14fe4
Добавлено поле interface_addr в ETCP_SOCKET и interface_ip/port в BGP_NAT_CHECK_REQ
...
- platform_compat: get_interface_ip_by_index() для получения IP по ifindex
- ETCP_SOCKET: interface_addr заполняется из конфига/interface/default route
- BGP_NAT_CHECK_REQ: добавлены interface_ip/interface_port (network byte order)
- route_bgp_send_nat_check_req: отправляет interface_addr линка
- route_bgp_handle_nat_check_req: принимает interface данные в sockaddr-заглушку
5 months ago
Evgeny
cbde38d52a
Remove accidentally committed binaries and temp files
5 months ago
Evgeny
77fd7c19de
WIP: debug byte order diagnostics
5 months ago
Evgeny
d74ab1c1c6
Add name parameter to uasync_set_timeout for timer identification in dumps
5 months ago
Evgeny
3c0b5f501a
Fix: use allocated_count from mem.c for busy memory calculation
...
busy = u_get_allocated_count() - memory_pool_get_total_free_blocks()
5 months ago
Evgeny
cee9a04348
GUI: add active timeouts and busy memory blocks counters
...
- Add timeout_heap_get_size() to get active timer count
- Add global counters in memory_pool: g_total_free and g_total_allocated
- Simplify busy memory calculation to single formula:
busy = memory_pool_get_total_allocated() - memory_pool_get_total_free_blocks()
- Add new IDC_EDIT_ACTIVE_TIMEOUTS and IDC_EDIT_BUSY_MEMORY to GUI
5 months ago
Charlie Root
e596564abd
1
5 months ago
Evgeny
cfd1e53ee9
mem: add allocations and frees counters with u_mem_get_counters()
5 months ago
Charlie Root
4e2b1c0c01
1
5 months ago
jeka
c57f94f38d
1
5 months ago
Charlie Root
09248bdbb6
1
5 months ago
Evgeny
41952703d9
Memory: use DEBUG for hex_dump output instead of printf
5 months ago
Evgeny
f195d1d91e
Memory: refactor hex_dump to use buffer with DEBUG output
5 months ago
Evgeny
7b305e820f
1
5 months ago
Evgeny
912eb8480c
Memory: add hex dump for unfreed blocks in u_report_unfreed_blocks
5 months ago
Evgeny
2558942da1
Memory: add location tracking to pool alloc/free with debug logging
5 months ago
jeka
d975696543
1
6 months ago
Evgeny
8bad15b7bb
1
6 months ago
Evgeny
122e619649
1
6 months ago
jeka
c1d2d26cae
1
6 months ago
Evgeny
b613e3a8e0
serializer
6 months ago
Evgeny
5dc8ad6784
1
6 months ago