Skip to content

net: static route via a LAN gateway masquerades LAN traffic to its target - #130

Merged
Cd1s merged 1 commit into
mainfrom
fix/static-route-via-lan-gateway
Oct 16, 2026
Merged

Cd1s merged 1 commit into
mainfrom
fix/static-route-via-lan-gateway

Conversation

@Cd1s

@Cd1s Cd1s commented Oct 16, 2026

Copy link
Copy Markdown
Owner

What

mod_net_render.go: for every IPv4 main-table static route whose via lies in a LAN-side network, srcnat gets
iifname "<br>" oifname "<br>" ip saddr <net> ip daddr <target> masquerade comment "route-via-lan:<target>". Test: TestLANGatewayRouteNAT; docs in docs/modules/net.md.

Why

With e.g. {target: 10.77.0.0/24, via: <downstream router on the LAN>}, a LAN device's packets to the target go through the router, but the gateway answers the device directly on the shared LAN. The router never sees the SYN-ACK, so the device's next packets are ct state invalid and dropped in forward.

Verification

  • sudo ./tools/ci.sh: ALL CHECKS PASSED.
  • On an AX6000 with a downstream router's /24 behind a LAN address: TCP from a LAN client to that subnet is masqueraded and works (and stays hardware-offloaded); before, it only worked when the subnet was reached some other way.

Closes #129

…to its target

Replies came straight back from the gateway, the router only saw one direction and conntrack dropped the
connection as invalid.

Closes #129
@Cd1s
Cd1s merged commit 14dc192 into main Oct 16, 2026
2 checks passed
@Cd1s
Cd1s deleted the fix/static-route-via-lan-gateway branch October 16, 2026 17:59
@Cd1s Cd1s mentioned this pull request Oct 16, 2026
52 tasks done
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.

Static route via a gateway on the LAN: replies bypass the router, conntrack drops the connection as invalid

1 participant