Commit 2ec4f18
committed
Fix route manager to support IPv6 server addresses with IPv4 tunnel
This ensures correct route setup when Lightway client is connected to
an IPv6 endpoint. The IPv4 tunnel stays unchanged.
Changes:
- Use /128 prefix for IPv6 server routes (was incorrectly using /32)
- Use /32 prefix for IPv4 server routes (unchanged)
- Monitor IPv6 default route changes when server is IPv6
- Monitor IPv4 default route changes when server is IPv4
- Fix LAN mode to only use gateway if address family matches route
- Fix find_route to return proper error instead of panicking on None
- Add mock IPv6 default route via loopback for test environments without IPv6
- Add host_prefix_len() and same_ip_family() helper functions
Tests:
- Add IPv6 and IPv4 test constants, update all tests to use them explicitly
- Update create_test_setup() to accept server_ip parameter
- Add test_ipv6_server_route_manager_creation()
- Add test_privileged_ipv6_server_initialize_route_manager()
- Add test_privileged_ipv6_server_route_update()
- Mock route only looks for ::1 (not 127.0.0.1) when finding loopback
The tunnel interface remains IPv4-only (TUN_PEER_IP, TUN_DNS_IP),
only the server connection endpoint supports IPv6.1 parent b309d52 commit 2ec4f18
1 file changed
+239
-37
lines changed
0 commit comments