This series contains:
* a unit test that exposes a race condition which causes QEMU to fail
to find a port even when there is plenty of available ports.
* a refactor of the qemu-sockets inet_listen_saddr() function
to better handle this situation.
Changes from v5:
* Also move setting of error from socket creation out
into the main double for loop.
* Simplify and enhance reporting if socket creation fails:
Only report failure to create sockets if none of the
provided addrinfo list elements allows creation of a
socket, otherwise report failure to find an available port.
* Further simplify if's within the for loops and make sure
failure to recreate a socket gets distinctively reported.
* Rebased to current master.
Changes from v4:
* Move the complexity of recreating a socket and setting the error pointer
into the main for loop, eliminating the try_bind_listen() function
again. Cleaning up and improving error handling in the process.
Changes from v3:
* Test changes: Add missing license
Add subtests for ipv4, ipv6 and both
Various g_* usage improvements
* Split patch into 3 patches with two refactoring patches ahead
of the actual fix.
Changes from v2:
* Non-trivial rebase + further abstraction
on top of 7ad9af343c7f1c70c8015c7c519c312d8c5f9fa1
'tests: add functional test validating ipv4/ipv6 address flag handling'
Changes from v1:
* Fix potential uninitialized variable only detected by optimize.
* Improve unexpected error detection in test-listen to give more
details about why the test fails unexpectedly.
* Fix some line length style issues.
Thanks,
Knut
Knut Omang (4):
tests: Add test-listen - a stress test for QEMU socket listen
sockets: factor out a new try_bind() function
sockets: factor out create_fast_reuse_socket
sockets: Handle race condition between binds to the same port
tests/Makefile.include | 2 +-
tests/test-listen.c | 253 ++++++++++++++++++++++++++++++++++++++++++-
util/qemu-sockets.c | 138 +++++++++++++++--------
3 files changed, 345 insertions(+), 48 deletions(-)
create mode 100644 tests/test-listen.c
base-commit: a588c4985eff363154d65aee8607d0a4601655f7
--
git-series 0.9.1