ostp/ostp-tun/src
ospab 321365efe3 fix(tun): TUN routing failed on every connect, freezing under load
A user's log showed the same two failures on all 9 connects, 198 route errors
total:
  Added 0 bypass routes via 192.168.88.1 (if_index=11)
  Could not find ostp_tun index in routing table after 15s — traffic will NOT be captured

Two independent bugs in the Windows route layer:

1. The TUN interface index was looked up by matching FriendlyName == "ostp_tun"
   through GetAdaptersAddresses. WinTun does not set the FriendlyName to the
   adapter name, so the match never succeeded — every connect burned the full
   15s window and gave up. The tun crate hands the real index back directly via
   AbstractDevice::tun_index() (WinTun's own adapter index), which is instant and
   correct; the name lookup remains only as a fallback.

2. Every route add — the server-IP bypass and the TUN default route alike — went
   through the legacy CreateIpForwardEntry, which failed with error 160
   (ERROR_BAD_ARGUMENTS) on this machine for all of them. With the server-IP
   bypass never installed, the server's own packets were routed INTO the tunnel:
   a loop that stalls the link for seconds under load (the reported "VPN drops
   ~8s into a game" — the tunnel never actually disconnected, it froze; the log
   showed gap recovery skipping up to 402 frames with no packet loss on the
   wire). add_ipv4_route now shells to route.exe, which resolves the interface
   and validates the gateway itself and is already what the teardown path uses;
   its command form was verified to be accepted (fails only on elevation, not
   syntax). CREATE_NO_WINDOW keeps it from flashing a console per route.

Cannot be verified without the user's elevated TUN environment; the next log
will read "Added N bypass routes" and "Default route via TUN ... added" instead
of the failures.
2026-08-18 23:13:51 +03:00
..
lib.rs feat(tun): implement process bypass for TCP/UDP and IP bypass for UDP using existing Extended tables 2026-06-14 00:02:08 +03:00
linux.rs feat: implement wintun dynamic downloading, add missing driver frontend modal, fix background logging and UAC helper issues 2026-06-09 01:01:36 +03:00
macos.rs feat: implement wintun dynamic downloading, add missing driver frontend modal, fix background logging and UAC helper issues 2026-06-09 01:01:36 +03:00
windows.rs fix(tun): TUN routing failed on every connect, freezing under load 2026-08-18 23:13:51 +03:00
windows_route.rs fix(tun): TUN routing failed on every connect, freezing under load 2026-08-18 23:13:51 +03:00