Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix in-use VNC socket detection for qemu
The `qemu_vm` probes the availability of a free VNC port by creating a socket and binding to it. If that succeeds, the port is considered free. The problem is that `find_free_ports()` in the avocado network utils defaults to "localhost" (=127.0.0.1) for the socket address while qemu later binds the VNC port to "0.0.0.0". Starting with kernel 6.2.8 / 6.3.x+, the kernel behavior changed. While the avocado code considered a port as available, later on the start of qemu using that port failed with an "in use socket". As qemu additionally uses SO_REUSEADDR for the socket and this allows certain socket configuration to both bind for 0.0.0.0 and 127.0.0.1. It's unclear if the new kernel behavior is 100% correct, but it does not matter since the correct thing to do is to use the matching socket address 0.0.0.0 in avocado. Broken behavior has been tested with kernel 6.2.8, 6.4.15, 6.5.5 and 6.6.13. Fix has been confirmed using the last. May be related: https://lore.kernel.org/netdev/[email protected]/T/#m34ca2f2765e5532243c7d20a4279baccf2ef9194 torvalds/linux@28044fc
- Loading branch information