diff --git a/cloud-hypervisor/tests/integration.rs b/cloud-hypervisor/tests/integration.rs index 14d709825..0411820c5 100644 --- a/cloud-hypervisor/tests/integration.rs +++ b/cloud-hypervisor/tests/integration.rs @@ -5600,6 +5600,19 @@ mod common_parallel { guest .ssh_command("sudo ip addr add 172.16.1.2/24 dev ens6") .unwrap(); + // Disable IPv6 on the interface before bringing it up to avoid + // IPv6 link-local autoconfiguration emitting NDP/RS packets which + // would invalidate the "zero packets" precondition checked below + // (some guest kernels emit these before our stats query races in). + // Use `sysctl -e` so the command is a no-op (rather than an error) + // on kernels built without IPv6, where these keys do not exist. + guest + .ssh_command( + "sudo sysctl -e -w net.ipv6.conf.ens6.disable_ipv6=1 \ + net.ipv6.conf.ens6.accept_ra=0 \ + net.ipv6.conf.ens6.autoconf=0", + ) + .unwrap(); guest.ssh_command("sudo ip link set up dev ens6").unwrap(); // Check there is no packet yet on both TX/RX of the network interface