Currently all the network listeners in QEMU, except the VNC server, are restricted to listening on a single socket. This makes it impossible to fully support IPv4/IPv6 dual stack. We're restricted to using IPV6_V6ONLY=0 to listen on both protocols from a single socket, but this doesn't work at all on OpenBSD, and even where supported it is quite crude (only really works for localhost and wildcard addresses).
This patch series introduces a new object QIONetListener, which encapsulates multiple QIOChannelSocket listeners. This makes it trivial to support multiple listening sockets in any part of QEMU. Daniel P. Berrange (8): tests: add functional test validating ipv4/ipv6 address flag handling io: introduce a network socket listener API blockdev: convert internal NBD server to QIONetListener blockdev: convert qemu-nbd server to QIONetListener migration: convert socket server to QIONetListener chardev: convert the socket server to QIONetListener ui: convert VNC server to QIONetListener sockets: fix parsing of ipv4/ipv6 opts in parse_socket_addr blockdev-nbd.c | 50 +-- chardev/char-socket.c | 70 ++-- include/io/net-listener.h | 174 +++++++++ io/Makefile.objs | 1 + io/net-listener.c | 315 ++++++++++++++++ migration/socket.c | 44 +-- qemu-nbd.c | 50 +-- tests/.gitignore | 1 + tests/Makefile.include | 3 + tests/test-sockets-proto.c | 906 +++++++++++++++++++++++++++++++++++++++++++++ ui/vnc.c | 194 +++------- ui/vnc.h | 9 +- util/qemu-sockets.c | 36 +- 13 files changed, 1563 insertions(+), 290 deletions(-) create mode 100644 include/io/net-listener.h create mode 100644 io/net-listener.c create mode 100644 tests/test-sockets-proto.c -- 2.13.3