Evgeny
616be0f15a
add backpressure support: uip_retry_timer, feed drain at closing_tun/sent, send buffering with retry
...
- proxy_uip_retry_cb: retry send from uip_to_transport every 5ms
- proxy_recv_cb: buffer to uip_to_transport when send fails, set retry timer
- proxy_feed: drain transport_to_uip when closing_tun || closing_sent (prevents RST)
- proxy_recv_cb(p==NULL): only tcp_recved + closing_tun, no drain
- proxy_poll_cb/tcp_proxy_destroy: cancel retry timer on cleanup
- uip_retry_timer field in proxy_conn
2026-05-31 03:31:03 +03:00
Evgeny
fca2ef1960
add DEBUG_ERROR in all silent proxy error paths: NULL checks, alloc fails, transport send fail, data drop
2026-05-31 01:58:44 +03:00
Evgeny
2aac55ca2c
add SOCK:EVENT unified diagnostics on exit: NEW/CONN/SEND/RECV/CLOSE/TIMER with fd, stream, total count
2026-05-31 01:31:59 +03:00
Evgeny
d042a6dd6a
drain transport_to_uip at FIN to prevent data delivery after close (eliminates RST storm)
2026-05-31 01:05:12 +03:00
Evgeny
4d8ff45586
fix tun_platform_write return value on FreeBSD: subtract 4-byte AF_INET header from writev result
2026-05-31 00:53:19 +03:00
Evgeny
a13d1e58d4
add TUN write hex dump diagnostic (ip_total, ver_ihl, proto, first 32 bytes hex) in traffic category
2026-05-31 00:44:17 +03:00
Evgeny
1529a6c2b9
add TUN write diagnostic: log tun_platform_write errors
2026-05-31 00:31:47 +03:00
Evgeny
21db2d6281
remove feed block after CLOSE: feed must remain active for streaming and half_close after FIN
2026-05-31 00:14:42 +03:00
Evgeny
c429a57db8
final RST fix: tcp_recved before closing_tun, feed stop after CLOSE, free unsent before tcp_close, proxy_try_close helper
...
- proxy_recv_cb(p==NULL): tcp_recved(pcb,gap) before closing_tun
- proxy_feed_from_transport: stop when closing_sent
- proxy_poll_cb cleanup: free unsent before tcp_close
- proxy_try_close helper: shared between poll_cb (500ms) and recv_cb
- pending_out check: don't close if data still queued for exit
- Configs: traffic=info, tun=info for diagnostics
2026-05-31 00:02:01 +03:00
Evgeny
69ae381f14
fix RST storm: stop proxy_feed after CLOSE sent + free unsent before tcp_close
2026-05-30 23:38:42 +03:00
Evgeny
a25d4dc9c8
fix RST on FIN: tcp_recved in proxy_recv_cb BEFORE closing_tun, guard proxy_err_cb with !closing_sent
2026-05-30 23:24:37 +03:00
Evgeny
75892d6f04
fix RST storm: tcp_recved before tcp_close in proxy_poll_cb cleanup
2026-05-30 23:06:28 +03:00
Evgeny
757514d95a
add lwIP state diagnostics: tcp_alloc cwnd/sndbuf, proxy_poll_cb cwnd/unsent/unacked, active_pcbs counter
2026-05-30 22:40:31 +03:00
Evgeny
b48fe18c2a
fix tcp_proxy connection lifecycle: closing_sent, destroy transport, shutdown+timer on exit
...
- Add closing_sent flag to proxy_conn (CLOSE sent to exit, no need to wait for reply)
- proxy_poll_cb: send CLOSE when done || sndbuf==0; cleanup when tun && (rem||sent)
- Destroy transport in proxy_poll_cb cleanup (fix 56-byte leak)
- remote_proxy_handle_close: shutdown(SHUT_WR) + 2s timer instead of immediate rp_conn_free
- Remove SHUTDOWN subcommand entirely (not needed with new lifecycle)
2026-05-30 22:03:37 +03:00
Evgeny
b7a5a6dade
fix half_close: send CLOSE from proxy_poll_cb when no pending data, shutdown not close on exit
2026-05-30 20:52:25 +03:00
Evgeny
39b222939e
fix tcp_proxy deadlock: send CLOSE on TUN FIN + full proxy diagnostics
...
- proxy_recv_cb(p=NULL): now calls transport->close() to signal exit side
- Add PROXY FIN/CLOSE/CONNECTED/DATA/FEED/TCP_IN/TCP_OUT logs
- Add RP RECV/SEND/CLOSE logs on exit side
- Fix queue_dgram_free/queue_entry_free ordering (UAF) in all proxy files
- Change TRAFFIC logs from ERROR to INFO level
- Add 2 extra 1MB tests in run_test.sh to verify no post-stress stall
- stress_client.py: add --verbose per-thread timing (connect/send/recv ms)
- mem.c: zero freed memory for early UAF detection
2026-05-30 20:42:44 +03:00
Evgeny
de6276fed4
clear freed memory in u_free_impl to catch UAF earlier
2026-05-30 20:03:33 +03:00
Evgeny
0dbebc0ddb
fix use-after-free in queue_entry_free/dgram_free ordering + add tcp_proxy stress test + proxy diagnostics logging
...
- Fix queue_entry_free before queue_dgram_free in all proxy files (UAF bug causing segfault)
- Add PROXY/RP prefixed diagnostic logs for transparent proxy flow tracking
- Add tcp_proxy integration test: real utun instances, ETCP, remote_proxy, DNAT routing
- 7 test scenarios: basic_1mb, concurrent_5, concurrent_20, half_close, idle, conn_refused, stress (10 threads x 20 iterations)
- stress_client.py with --verbose per-thread phase timing (connect/send/recv)
2026-05-30 20:01:05 +03:00
Evgeny
5a0f35953e
set FreeBSD TUN remote address to 192.0.2.1 instead of same as local
2026-05-30 13:13:08 +03:00
Evgeny
4511ece7e6
disable BACKTRACE_ENABLED to fix lld linker error with backtrace symbols
2026-05-30 02:17:46 +03:00
Evgeny
72704dfa04
fix compiler warnings: C23 label+declaration, uint16_t overflow check
2026-05-30 02:12:47 +03:00
Evgeny
aca73c5e66
add lwIP TCP stack test with fixes: rcv_wnd tracking, FIN compensation, tmr_phase dual-counter, trace ring buffer, stats counters
2026-05-30 01:39:34 +03:00
Evgeny
f8ba1d2755
update timeout_heap and u_async: O(1) cancel, heap cancel bubble-up fix, epoll callback safety, uasync_stop, socket_array u_realloc
2026-05-29 01:11:37 +03:00
Evgeny
3193eed907
fix route_bgp etcp_send leaks and etcp_socket_remove infinite loop on link->conn==NULL
2026-05-14 03:52:13 +03:00
Evgeny
ae7d61fe4d
fix INIT bounds checks and eim_nat port uint16_t wrap
2026-05-14 03:50:01 +03:00
Evgeny
1b469424c5
fix route_bgp/route_ping: old paths queue leak, etcp_send fail leak, nat_check_arg leak on cancel
2026-05-14 03:40:24 +03:00
Evgeny
5a72fc4d07
fix pkt_normalizer: null deref on alloc fail, mtu underflow, unchecked pn_buf_renew in loop
2026-05-14 03:38:21 +03:00
Evgeny
971d62c256
fix ETCP: dgram leak on inflight pool exhaustion, cancel dangling timers on link close/new
2026-05-14 03:35:26 +03:00
Evgeny
ddf59aab3f
fix uasync: posted_tasks delivery on Linux, create cleanup leaks, atomic array expand
2026-05-14 03:32:23 +03:00
Evgeny
06684e874a
add audit findings document (51 issues across 12 modules)
2026-05-14 03:25:57 +03:00
Evgeny
1617c05a74
fix stale pointer after realloc in uasync socket/event handlers
2026-05-14 01:24:06 +03:00
Evgeny
79ae966994
add 16-bit seq to TCP proxy DATA for loss/duplicate detection
2026-05-13 13:28:05 +03:00
Evgeny
0314668629
fix use-after-free in tests: swap queue_entry_free/queue_dgram_free order, fix dangling timer handles and stack args; add ETCP MTU bounds, assembly overflow check, etcp_update_mtu
2026-05-13 12:38:20 +03:00
Evgeny
ce9ab2ee2e
fix TCP data stall: feed transport_to_uip on ETCP recv, tcp_poll interval 0→2 for close detection
2026-05-13 10:31:38 +03:00
Evgeny
256b629877
add periodic cleanup timers for ICMP pending requests and UDP flows
2026-05-13 09:02:24 +03:00
Evgeny
8686350b5b
redesign TCP close: closing_tun/closing_rem flags, poll-driven cleanup, proper half-close
2026-05-13 03:18:29 +03:00
Evgeny
71117786a4
fix remote_proxy: cleanup socket on EOF/error/connect-fail to prevent infinite callback loop
2026-05-13 02:32:26 +03:00
Evgeny
ec9ccc95fb
fix lwIP TCP checksums on LE: remove htons from pseudo-header sum, add htons to return values
2026-05-13 02:11:59 +03:00
Evgeny
9ae1b92d37
fix tcp_pseudo_checksum: add ntohs() to correctly extract 16-bit IP halfwords from NBO on LE
2026-05-13 01:55:14 +03:00
Evgeny
c9de5cdc2a
fix tcp_proxy_ensure_outbound_listen: pass network byte order port to tcp_bind
2026-05-13 01:37:59 +03:00
Evgeny
7872e11444
add transparent outbound TCP proxying: dynamic listen on unknown ports, fwd to exit
2026-05-13 00:47:40 +03:00
Evgeny
fab4c9506d
fix TCP close: properly close lwIP pcb on both sides, fix use-after-free, add poll close path
2026-05-13 00:16:35 +03:00
Evgeny
000c3ef016
fix missing IP checksum in icmp/udp deliver_reply, fix udp output_queue->input_queue
2026-05-12 23:38:35 +03:00
Evgeny
f1cc5f2b36
fix icmp_proxy: write reply to input_queue (not output_queue) to reach TUN device
2026-05-12 23:19:56 +03:00
Evgeny
0dd5ff8c87
add orig_src_ip to ICMP proxy protocol, fix deliver_reply dst_ip (was wrong tun_ip_addr)
2026-05-12 23:03:49 +03:00
Evgeny
4ba9157ca8
add etcp_router INFO logs for ICMP_PROXY reply path (send+deliver)
2026-05-12 22:45:57 +03:00
Evgeny
1a10c9607b
add icmp_proxy diagnostic logging on all reply path stages
2026-05-12 22:30:16 +03:00
Evgeny
6a35e53e31
fix icmp: use SOCK_RAW for FreeBSD compat, add socket diagnostic logging
2026-05-12 22:08:30 +03:00
Evgeny
19603b83ee
fix lwip_tcp_priv.h: use #ifndef _WIN32 for arpa/inet.h (FreeBSD compat)
2026-05-12 22:00:41 +03:00
Evgeny
b49b81a5a8
replace fake ICMP echo reply with test_loopback flag, honest error when no raw socket
2026-05-12 21:46:16 +03:00