Skip to content

Reach a gateway on the LAN directly - #60

Merged
GarageDeveloper merged 1 commit into
mainfrom
fix-lan-gateway-route
Nov 19, 2026
Merged

GarageDeveloper merged 1 commit into
mainfrom
fix-lan-gateway-route

Conversation

@GarageDeveloper

Copy link
Copy Markdown
Owner

The host route that keeps a tunnel's transport off the tunnels always went through the default router, even when the VPN server is on the uplink's own network (a server on the office or home LAN). The packets then go to the router instead of straight to the server, and the replies may never come back. We saw it on Windows during the port: handshake done, then nothing received.

The route now goes straight to the interface when the interface's own route to the gateway has no router:

  • macOS: route -n get -ifscope <if> <gw> has no GATEWAY flag.
  • Linux: ip -4 route get <gw> oif <if> has no via.

If the lookup fails, the router is kept. The route is removed the same way it was added: the uplink stored for the gateway, and the journal entry, name no router.

Tests:

  • gateway_on_the_link: parses real output from both commands.
  • clippy and the tests pass on macOS.
  • interop/service/run.sh (Linux, systemd, WireGuard) passes.

🤖 Generated with Claude Code

The host route that keeps a tunnel's transport off the tunnels named the
default router even when the gateway was on the uplink's own network (a
VPN server on the LAN): the packets went to the router, and the answers,
sent directly, might never match (seen on Windows: handshake done, then
nothing). The route now goes through the interface when the interface's
own route to the gateway has no router (`route get -ifscope` on macOS,
`ip route get ... oif` on Linux); a failed lookup keeps the router.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@GarageDeveloper
GarageDeveloper merged commit 36a8aee into main Nov 19, 2026
6 checks passed
@GarageDeveloper
GarageDeveloper deleted the fix-lan-gateway-route branch November 19, 2026 14:17
GarageDeveloper added a commit that referenced this pull request Nov 19, 2026
The on-link check moves from every route through the uplink to the
gateway host route, behind the hook macOS and Linux now share (#60).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant