Repository navigation
Conversation
A reply on a UDP flow that a rule proxies reaches the application as if it came from the remote peer: socks5_udp_local_redirect restores the peer named in the SOCKS5 UDP header. If the application's socket has closed when the reply arrives, Windows reports it with an ICMP "port unreachable" (ICMPv6 "destination unreachable") error addressed to that peer. The error leaves the adapter directly, from the computer's own address, and quotes the reply, so the peer learns the real address and sees the reply contents. The previous commit handled this for DNS answers in Proxy mode only. - An outbound ICMP or ICMPv6 error is dropped when the UDP datagram it quotes was addressed to a client port with an active entry in the UDP redirect of that family. This applies in either DNS mode. The redirect is keyed by client port, so a datagram that port received directly is matched too; that sender already knows the address and only loses the error report. Ping, neighbor discovery, TCP quotes and errors about unproxied ports are passed. The first drop per run is logged at info level with the port; later drops are counted at debug level. - The quoted-header parsing in dns_routing_policy.h now returns both quoted ports (icmpv4_error_quote(), icmpv6_error_quote()). The source-port helpers are kept as wrappers. decide_icmp_error() takes the quote and a lookup of redirected client ports, and only calls the lookup (and so takes the redirect's lock) for a quoted UDP datagram with both ports. - socks5_udp_local_redirect::is_active_endpoint() reports whether a client port has an entry that has not timed out (15 minutes, now a named constant). - The REDIRECT filter for outbound ICMP is now needed outside DNS Proxy mode: for IPv4, the router's ICMP PASS filter would otherwise pass the error in the driver. plan_icmp_error_filters() installs it per address family when that family has a UDP listener, and for both families in DNS Proxy mode. install_icmp_error_filters() runs on start() and also when add_socks5_proxy() adds a UDP listener to a running router. It only adds missing filters, so there is never a moment without one. - Tests: quote parsing (both ports, a quote cut between them), the decision in both modes, the lookup only being consulted for quoted UDP, and the filter plan. The portable suite also drives the real redirect: an IPv4 and an IPv6 application flow is redirected, the listener's reply is translated, and the stack's error about the translated reply is dropped, while ping and errors about unredirected ports pass. - Docs: the behaviour and the filter in configuration.md, and a Windows validation step with pktmon/Wireshark in gui.md.
wiresock
force-pushed
the
claude/ecstatic-mccarthy-8tehu6
branch
from
November 14, 2026 07:41
4d98555 to
d26dbba
Compare
Step 16 told the tester to close the socket before the reply arrives. A socket closed at once is gone before its datagram can be attributed to the application, so the datagram is sent directly, the server answers directly, and the ICMP error about that direct reply is passed, which looks like the drop not working. Measured on Windows with 12 datagrams per delay: closed after 0 ms, all 12 went out directly; after 2 ms, 9 did; after 10 ms and 30 ms, none. The step now says to keep the socket open for about 50 ms, to use a server that delays its reply when the SOCKS5 server answers faster than that, and to confirm in the capture that no datagram went to the server directly. A STUN binding request is added to the example datagrams.
wiresock
merged commit Nov 14, 2026
e0493f9
into
claude/proxifyre-dns-routing-f94k1o
6 checks passed
This was referenced Nov 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #190 (based on its branch); one commit,
d26dbba. It extends216bcf6from DNS answers to all application UDP that a rule proxies.Problem
A reply on a proxied UDP flow reaches the application as if it came from the remote peer:
socks5_udp_local_redirectrestores the peer named in the SOCKS5 UDP header. If the application's socket has already closed when the reply arrives, Windows answers with an ICMP "port unreachable" (ICMPv6 "destination unreachable") error addressed to that peer. The error leaves the adapter directly, from the computer's real address, and quotes the reply. So the peer learns the client's real IP and sees the reply contents, bypassing the proxy.216bcf6fixed this for DNS answers in Proxy mode only; onmainand on #190, application UDP still behaves this way.Change
dns_routing_policy.h).icmpv4_error_quote()/icmpv6_error_quote()return both quoted ports; the existing source-port helpers are wrappers over them.decide_icmp_error(mode, quote, is_redirected_client_port)returnspass,drop_dns_answerordrop_proxied_udp_reply. It calls the lookup, and so takes the redirect's lock, only for a quoted UDP datagram with both ports, after the DNS check.socks5_udp_local_redirect::is_active_endpoint(); the 15-minute timeout is now a named constant.plan_icmp_error_filters(mode, ipv4_udp, ipv6_udp)asks for the outbound REDIRECT filter, at the front of the table, for each family with a UDP listener and for both families in DNS Proxy mode.install_icmp_error_filters()runs onstart(), and fromadd_socks5_proxy()when a UDP listener is added to a running router. It only adds missing filters, so there is no window without one.start(), or rejects the proxy being added.Tests
socks5_udp_local_redirect: an application datagram is redirected, the listener's reply is translated, and the stack's error about the translated reply is dropped, while ping and errors about unredirected ports pass.main.ymlrun built x86, x64 and ARM64 Release successfully, and the managed tests passed: https://github.com/wiresock/proxifyre/actions/runs/43570903168. It ran on4d98555, which has the same tree asd26dbba(only the commit metadata changed). The router class itself is not covered by an automated test.Windows validation required before merge
Not yet run on a machine with the driver. Step 16 of "DNS routing manual validation" in
docs/gui.mdcovers it:DirectDNS and a rule that proxies UDP, send a datagram to a server that answers after a delay (IPv4 and IPv6) and close the socket before the reply arrives. Capture at the physical NIC (pktmon or Wiresharkicmp.type == 3 || icmpv6.type == 1): no error addressed to the server leaves the adapter, and the log has one "Dropped an ICMP error about a proxied UDP reply" line.pingandping -6to the server still work; repeat inProxymode.Validation status (2026-11-14). Run on Windows 11 x64 with Windows Packet Filter 3.6.2.1 and a live SOCKS5-over-TLS server, capturing at the physical NIC with pktmon, against
d26dbba. All three items pass:216bcf6with the rule enabled: 12 IPv4 and 12 IPv6 errors quoting proxied replies left the adapter.pingis answered in both DNS modes.ping -6echo requests leave the adapter in both modes but get no reply, for lack of IPv6 connectivity.The sockets were closed 60 ms after sending. A socket closed at once is gone before its datagram can be attributed to the application, so the datagram leaves directly (12 of 12 at 0 ms, none at 10 ms or more) and the error is then about a direct reply; step 16 should say so.
Docs
docs/configuration.md: a third rule under "Local listener replies and TCP close handling", a paragraph on the ICMP filter, and a link from the DNS ICMP paragraph.docs/gui.md: validation step 16; later steps renumbered.