Evgeny
c05e1c9991
replace uIP with adapted lwIP TCP stack (lwip_tcp)
...
- Replace uIP (src/uip/) with adapted lwIP 2.1.x TCP module
- Remove original src/lwip/ (replaced by src/lwip_tcp/)
- New src/lwip_tcp/ module: lwip_pbuf, lwip_tcp core/in/out
- Full TCP state machine, sliding window, congestion control
- Fast retransmit/recovery, Van Jacobson RTT estimation
- Nagle algorithm (TF_NODELAY), delayed ACK
- OOSEQ reassembly, TIME-WAIT handling
- Memory: memory_pool for PCB, listen PCB, tcp_seg
- Timers: uasync periodic timer drives fast/slow timers
- Output: callback-based IP packet output (TUN/raw-fd)
- Error codes: LERR_ prefix to avoid conflicts
- pbuf: simplified PBUF_RAM with proper header space reservation
- Integrate into tcp_proxy.c/h with per-pcb callbacks
- Active connection API: struct proxy_conn* instead of int conn_idx
- Makefile: remove uip, add lwip_tcp files
- test_tcp_proxy updated for new API; test_tcp_proxy_remote disabled
- Known: test_tcp_proxy data transfer needs flow tuning (WIP)
5 months ago
Evgeny
a6311a17d0
add UDP/ICMP proxy, refactor tcp_proxy via_node to instance-level
...
- UDP proxy: datagram relay client↔exit over ETCP
- ICMP proxy: echo ping relay client↔exit over ETCP
- Move via_node_id from per-forward-mapping to global tcp_proxy setting
- Support multiple concurrent tcp_proxy instances (no singleton g_tcp_proxy)
- Cap handshake padding to stay within 1472+overhead
- Handle non-TCP packets (UDP/ICMP) in tcp_proxy raw/tun input paths
- Add utun_instance_create_from_str() for test config creation
5 months ago
Evgeny
9b59415f83
add tcp_proxy and remote_proxy sections to sample config
5 months ago
Evgeny
17e95cc2a3
fix remaining pointer-sign warnings in sc_set_peer_public_key callers
5 months ago
Evgeny
68f4ae12c8
fix all compiler warnings: array-bool, pointer-sign, tautological, unsequenced
5 months ago
Evgeny
a0e5446790
migrate NAT and DATA to etcp_router, fix warnings and destroy order
5 months ago
Evgeny
2611a05d81
revert unnecessary return -1 in void-test ASSERT macros; only test_bgp_route_exchange uses ASSERT in int main()
5 months ago
Evgeny
fcb6a59ca9
fix ASSERT macros: return -1 instead of bare return in int main() (FreeBSD -Wreturn-mismatch)
5 months ago
Evgeny
075d97a459
fix .gitignore: stop ignoring test_*.c source files; add missing test_ipv6_sockets, test_tcp_proxy, test_radix, test_route6_lib sources
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
2565e8d008
add uIP TCP/IP stack (minimal — only files needed for tcp_proxy build)
5 months ago
Evgeny
9869cf66f1
add etcp_router service routing layer + remote TCP proxy (uip+socket via router)
...
etcp_router: routable service packets with dst/src node_id
- etcp_router_bind/unbind: per-instance service handler registry
- etcp_route_send: send to node by id via BGP routing
- multi-hop forwarding through intermediate nodes
- loopback optimization (dst==self dispatches directly)
remote_proxy: exit node creating OS sockets on demand
- handles CONNECT/DATA/CLOSE via etcp_router
- non-blocking socket connect with uasync callbacks
- echo back response data to requesting node
tcp_proxy: etcp_transport for remote proxy
- via_node_id in mapping selects between sock/etcp transport
- unified handler for both tcp_proxy and remote_proxy roles
- config: forward = port -> ip:port via NODE_HEX [remote_proxy] section
tests: test_etcp_router (20 pkts bidirectional), test_remote_proxy (echo)
5 months ago
Evgeny
5e834b519f
mass_update: log all sessions to files, terminal output only for errors
5 months ago
Evgeny
171e70a810
add inflight data return to normalizer on reinit + configurable inflight min/max limits + test
5 months ago
Evgeny
dea3a39598
fix: reconnect test — cancel timers in conn_reset, add init_timer cancel on link_state=3, add reinit resilience to test
...
- etcp_conn_reset: cancel retrans_timer/ack_resp_timer via uasync_cancel_timeout
before nulling (was leaking timer handles, confirmed by 'Timer leak: diff')
- etcp_connections: cancel link->init_timer explicitly when link_state becomes 3
on both client and server INIT_RESPONSE paths (prevents spurious INIT after
connection is established that could trigger cascading reinits)
- etcp_connections: remove duplicate conn->session_id assignment in new conn path
(session_id is set later via conn_reinit flow)
- pkt_normalizer: resume output queue callback after pn_reset
- Add test_etcp_reconnect with reinit detection — monitors conn->reinit_count
and restarts data transfer if reinit occurs during active phase
- Add etcp_dump.c/h — ETCP connection state dump utility for debugging
5 months ago
Evgeny
0f8df44b2b
build: out-of-tree VPATH build, tests run once with colored timing
...
- Root Makefile: hand-written bootstrap delegating to build/
- Makefile.am: simplified to SUBDIRS + clean-local
- build.sh: delegates to make, autoreconf only
- tests: removed duplicate TESTS run, added colored [PASS]/[FAIL]/[SKIP] with timing
- .gitignore: added /build/ for out-of-tree artifacts
Result: 0 .o files in source dirs, 29/29 tests pass
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
e7c32d9ac1
1
5 months ago
Evgeny
7d03749522
1
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
edfe665837
log: move individual ping logs from INFO/TRACE to DEBUG level
5 months ago
Evgeny
6c057ca89a
fix BGP: delay up_cbk until connection initialized, fix send_table_request leak
5 months ago
Evgeny
a356eedc0d
cleanup BGP/connection logging
...
- Consolidate on_up/on_down to single INFO line with peer_id
- Remove DEBUG_CATEGORY_DEBUG duplications from route_bgp.c
- NODEINFO: inline lightweight dump (no malloc), verbose log -> DEBUG
- NAT_INFO: remove hex dump duplications, single clean INFO line
- Send NODEINFO per-recipient: INFO->DEBUG_DEBUG
- Per-ping callbacks: INFO->DEBUG_TRACE
- Per-packet traffic direction: INFO->DEBUG_TRACE
- route_insert/delete: use node_id instead of pointer
- Add cancel_all log, add_to_senders conn name
- send_full_table: ERROR->WARN for consistency checks
- is_local_subnet: DEBUG->TRACE
- Fix etcp_send_ping BGP category
5 months ago
Evgeny
227a1aafad
cleanup debug logging
5 months ago
Evgeny
048d1c18b1
fix: restore lost if(changed) block in update_my_nodeinfo + add debug warnings
5 months ago
Evgeny
bbebc74bdb
fix etcpmon keyboard: move Tab/Enter/Esc from WndProc to message loop pre-translate
5 months ago
Evgeny
973c00e544
add etcpmon keyboard navigation: Tab between Server/Port, Enter=Connect, Esc=Disconnect
5 months ago
Evgeny
fb76b4252f
fix etcpmon: stray brace in nat_type_to_string, add pipefail to build scripts
5 months ago
Evgeny
456d274e12
fix mass_update: remove git remote http->https rewrite (port 443 blocked on remotes)
5 months ago
Evgeny
c391d497b4
fix mass_update: skip tests build, fix git http redirect, speed up deploy
5 months ago
Evgeny
4e040b2891
fix mass_update: add pipefail so make errors stop the update script
5 months ago
Evgeny
f6ef38aa5d
update documentation
5 months ago
Evgeny
9c509d4c86
add connectivity probing + NAT type rename OPEN->EIM, RESTRICTED->STRICT
...
- Rename NAT types: OPEN->EIM, RESTRICTED->STRICT across all code
- Add flat addr list {type,ip,port,socket_id} to NODEINFO (NODEINFO_IPV4_ADDR)
- Add NODEINFO_IPV4_SOCKET_META for per-socket metadata
- Add NODE_CONNECTIVITY with per-type probe status and min_rtt
- New module: route_connectivity.c/h (probing engine with socket fallback)
- STRICT verified addresses excluded from NODEINFO broadcast
- Trigger probing on new/updated BGP node, cancel on remove/withdraw
- Update NAT type names in etcpmon GUI
5 months ago
Evgeny
39544e6b2b
Fix: Add bounds/mtu checks, underflow protection and null deref fix for ETCP robustness
5 months ago
Evgeny
2fadec947b
Fix: Split multi-var init and rename s_net/d_net to src_net/dst_net to avoid MSYS2 S_un macro conflict
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
8cb05da11c
Fix: Add forward declaration of struct UTUN_INSTANCE in route_node.h
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
3dd8fa4085
Fix: Remove arpa/inet.h from test_nat_stress.c and test_nat_transport.c, use platform_compat.h for byte-order funcs
5 months ago
Evgeny
ba30f2adc6
Fix: Remove arpa/inet.h from test_nat_engine.c, use platform_compat.h for byte-order funcs
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
b7da11c2bf
Crypto: Refactored ETCP header size calculations with offsetof-based defines, increased CCM tag to 16 bytes
5 months ago
Evgeny
a66edb8f5f
Crypto: Added SHA256-based KDF for session key derivation from ECDH shared secret
5 months ago
Evgeny
11d511797a
Fix compiler warnings: remove incorrect address-of operator and add getpid for Windows
...
- etcp_connections.c:1142: remove & before addr in sockaddr_storage_to_str call
- test_etcp_simple_traffic.c: add #include <process.h> and #define getpid _getpid for Windows
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
e0ce9fefc3
Fix allowed_keys check to only apply to ETCP_INIT packets, not PING/PONG
...
The allowed_keys authorization was incorrectly checking all INIT-decrypted
packets including PING/PONG. Moved the check after packet type validation
so it only applies to ETCP_INIT_REQUEST/NOINIT (incoming connection requests).
Fixes test_etcp_ping and test_nat_detection failures.
5 months ago