Enable IPv6 ULA, SLAAC Router Advertisements, NAT66, and E2E validation - #3104
Enable IPv6 ULA, SLAAC Router Advertisements, NAT66, and E2E validation#3104sferrogoo wants to merge 3 commits into
Conversation
eee6c24 to
c758369
Compare
|
@google/android-cuttlefish @adelva1984 @jemoreira PTAL |
… and E2E validation * Add IPv6 Unique Local Address (ULA) subnets fd00:cf:22::/64 (cvd-wbr) and fd00:cf:24::/64 (cvd-ebr) to cuttlefish-host-resources defaults and init script. * Configure dnsmasq to broadcast IPv6 Router Advertisements for guest SLAAC autoconfiguration. * Implement native nftables masquerading (NAT66) and forwarding rules in cuttlefish-host-resources.init. * Add nftables dependency in base/debian/control. * Add E2E network integration test in //cvd/network_tests:network_tests verifying SLAAC IP acquisition, guest-to-host dual-stack communication, and pure IPv6-only operation.
cd09095 to
4f5ccc3
Compare
| t.Fatalf("Timed out waiting for ADB device connection: %v", adbErr) | ||
| } | ||
|
|
||
| // 1. Verify SLAAC IPv6 assignment on in-guest network interface |
There was a problem hiding this comment.
factorize or split up the test further instead of doing this
There was a problem hiding this comment.
Done. Split the test into two separate flows: TestIPv6DualStackConnectivity and TestIPv6OnlyMode. Extracted the address discovery logic into a standalone pollIPv6Address() helper.
| var ip6Output e2etests.CommandOutput | ||
| var activeDev string | ||
| var gatewayIP string | ||
| for attempt := 1; attempt <= 15; attempt++ { |
There was a problem hiding this comment.
This was a retry mechanism to workaround several second delay after interface creation to process the host Router Advertisement and complete Duplicate Address Detection (DAD). I refactored however now to be much cleaner - Replaced the ad-hoc retry loop with a standard deadline-based pollIPv6Address() helper with an explicit 30s timeout.
| var activeDev string | ||
| var gatewayIP string | ||
| for attempt := 1; attempt <= 15; attempt++ { | ||
| // Check all potential network interfaces (wireless and ethernet bridges) |
There was a problem hiding this comment.
The following block is hard to reason about and this comment doesn't help.
There was a problem hiding this comment.
Refactored to make it more clear: Logic now is: Depending on the device configuration (e.g. WiFi vs Ethernet bridge), the active interface may be eth1 or wlan0. Rather than iterating hardcoded device names, pollIPv6Address() now runs a single ip -6 -o addr show scope global and dynamically selects whichever interface received the Cuttlefish ULA prefix (fd00:cf:...).
| // 2. Verify guest-to-host IPv6 connectivity | ||
| t.Logf("Verifying dual-stack guest-to-host IPv6 connectivity (gateway %s on %s)...", gatewayIP, activeDev) | ||
| // Query detected router link-local address from neighbor table | ||
| neighOut, _ := c.RunCmd("adb", "shell", fmt.Sprintf("ip -6 neigh show dev %s", activeDev)) |
There was a problem hiding this comment.
Done. Removed the raw neighbor table query and consolidated route installation into configureGuestIPv6Routes(), targeting the gateway discovered during SLAAC.
Let me know if you prefer more factorizing - like splitting out explicit test methods etc, happy to do so if it helps!
| } | ||
| t.Logf("Guest ULA: %s, Router LL: %s, Gateway ULA: %s", guestIP, routerLL, gatewayIP) | ||
|
|
||
| connCmd := fmt.Sprintf("su 0 toybox ping -6 -c 3 -I %s %s || su 0 toybox ping -6 -c 3 -I %s %s || su 0 toybox ping -6 -c 3 %s", guestIP, gatewayIP, activeDev, routerLL, gatewayIP) |
There was a problem hiding this comment.
Cleaned this ip a bit - replaced the chained ping fallback string with pingIPv6Target(), which manages the ping command more cleanly.
| } | ||
| t.Logf("Dual-stack IPv6 connectivity successful:\n%s", connOut.Stdout) | ||
|
|
||
| // 3. Uninstall / Flush IPv4 (Simulate IPv6-Only environment) |
There was a problem hiding this comment.
deserves a different test; you are testing too many variables within the one test.
There was a problem hiding this comment.
Done, Split the IPv4 flush and pure IPv6 routing assertions into a distinct TestIPv6OnlyMode test.
There was a problem hiding this comment.
Does this test depend on the test host actually having the defaults updated?
How can you run the test on a v4-only host?
There was a problem hiding this comment.
You're right it would fail in ipv4 only. I tweaked a bit - Added checkHostIPv6Support(), which runs before fetching or launching the CVD. It checks whether the host cuttlefish bridge (cvd-ebr or cvd-wbr) has an assigned ULA prefix. If the test host is IPv4-only, it calls t.Skip() so CI runs on older/unsupported runners do not fail.
| @@ -0,0 +1,159 @@ | |||
| // Copyright (C) 2026 The Android Open Source Project | |||
There was a problem hiding this comment.
This appears to have been added in another directory "network_tests" at the same level as the "networking_tests" directory. Perhaps this would be better with either:
- a different directory name, if the goal of these tests is different from the goal of tests in networking_tests/
- rolled into networking_tests/ as a new test file or a new test case
There was a problem hiding this comment.
Done. Removed network_tests/ and rolled the IPv6 tests directly into e2etests/cvd/networking_tests/ipv6_test.go so they share the existing test framework and Bazel targets.
| iptables, | ||
| jq, | ||
| less, | ||
| nftables, |
- Remove duplicate nftables dependency from debian/control. - Roll IPv6 integration tests into existing networking_tests suite. - Factorize IPv6 address polling and connectivity assertions with timeouts. - Separate dual-stack connectivity from IPv6-only flush tests. - Add test host IPv6 bridge check to skip gracefully on IPv4-only hosts.
|
Pushed commit 457a75c addressing all review comments:
|
|
@dxapd @3405691582 PTAL, addressed all feedback in commit 457a75c. |
Description
This change adds complete IPv6 support for Cuttlefish instances on the host and validates guest dual-stack and pure IPv6-only operation.
IPv6 Unique Local Addresses (ULA):
fd00:cf:22::/64oncvd-wbrandfd00:cf:24::/64oncvd-ebr./etc/default/cuttlefish-host-resources.Router Advertisements (SLAAC):
dnsmasqto broadcast SLAAC Router Advertisements for autonomous in-guest address assignment.NAT66 & Forwarding:
nftablesmasquerading and forwarding rules incuttlefish-host-resources.init.nftablespackage dependency tocuttlefish-baseindebian/control.Automated E2E Integration Testing:
//cvd/network_tests:network_testsverifying guest SLAAC acquisition, guest-to-host dual-stack communication, and 100% pure IPv6-only functionality after flushing IPv4.