4 Commits

Author SHA1 Message Date
世界 73f8bbda86 Make gtcpip public for external use 2026-04-20 09:20:56 +08:00
世界 1ab008e1e6 Improve error messages for Linux TUN and redirect operations 2026-03-15 14:43:38 +08:00
世界 0329538ecd Fix "Fix auto_redirect dropping SO_BINDTODEVICE traffic" 2026-03-14 20:58:43 +08:00
世界 caaf8469e0 Fix auto_redirect dropping SO_BINDTODEVICE traffic
REDIRECT in the OUTPUT chain rewrites the destination to 127.0.0.1,
then ip_route_me_harder() reroutes with the socket's bound interface
constraint (flowi4_oif). Since 127.0.0.1 is only reachable via lo,
the routing lookup fails and the packet is silently dropped.

Add a fallback routing table with `local 127.0.0.1` entries for each
non-loopback interface. When the local table lookup fails due to OIF
mismatch, the fallback table provides a matching RTN_LOCAL route.
The kernel then overrides dev_out to loopback (route.c:2857), so the
packet is delivered locally to the redirect server as intended.

This fixes NetworkManager connectivity checks and other tools that
use SO_BINDTODEVICE (e.g. curl --interface).
2026-03-11 21:15:11 +08:00