All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/8] io: enable DNS resolving separately of socket create
@ 2017-01-05 16:03 Daniel P. Berrange
  2017-01-05 16:03 ` [Qemu-devel] [PATCH 1/8] sockets: add ability to disable DNS resolution for InetSocketAddress Daniel P. Berrange
                   ` (7 more replies)
  0 siblings, 8 replies; 22+ messages in thread
From: Daniel P. Berrange @ 2017-01-05 16:03 UTC (permalink / raw)
  To: qemu-devel

Currently DNS resolution of SocketAddress structs is done as
part of the socket connect/listen process. This is very
inflexible as it assumes that a single SocketAddress struct
will only ever require a single socket to be opened. While
true for connect(), it is not the case for listen() in two
scenarios

 - A name may resolve to both an IPv4 and IPv6 address. Currently
   we workaround that by clearing the IPV6_V6ONLY flag.

 - A name may resolve to multiple IP addresses of the same
   protocol. eg "myhostname" may return "192.168.122.1" and "10.0.0.2"
   when the host has multiple NICs, or multiple addresses per NIC.

The only way to deal with the latter problem is to open multiple
sockets and that requires the ability to separate DNS resolution
from socket creation.

This series thus enhances the I/O framework in QEMU to introduce
the "QIODNSResolver" concept. This (singleton) object allows the
caller to feed in a single SocketAddress struct, perform DNS
resolution, and get back out one or more new SocketAddress structs
for the results. The API allows both synchronous and asynchrounous
DNS lookups, the latter done by spawning a thread to do the
getaddrinfo call via the QIOTask framework.

In this series the InetSocketAddress struct gains a new field to
let the caller indicate that the address is providing a numeric
host value, thus skipping DNS altogether.

The QIOTask object had some refactoring to allow results to be
associated with it explicitly, so that the asynchronous DNS
results can be passed around. This triggered the code churn
across other files in QEMU using QIOTask.

This series will be utilized by a second series that will be
sent that updates the VNC server code to use this new feature.

Daniel P. Berrange (8):
  sockets: add ability to disable DNS resolution for InetSocketAddress
  io: stop incrementing reference in qio_task_get_source
  io: fix typo in docs for QIOTask
  io: add ability to associate an opaque "result" with with a task
  io: add ability to associate an error with a task
  io: change the QIOTask callback signature
  io: remove Error parameter from QIOTask thread worker
  io: introduce a DNS resolver API

 include/io/dns-resolver.h      | 224 ++++++++++++++++++++++++++++++++++
 include/io/task.h              | 151 ++++++++++++++++-------
 include/qemu/sockets.h         |   2 +
 io/Makefile.objs               |   1 +
 io/channel-socket.c            |  50 ++++----
 io/channel-tls.c               |  16 +--
 io/channel-websock.c           |   8 +-
 io/dns-resolver.c              | 265 +++++++++++++++++++++++++++++++++++++++++
 io/task.c                      |  62 +++++++---
 io/trace-events                |   1 -
 migration/socket.c             |  11 +-
 migration/tls.c                |  19 +--
 nbd/common.c                   |   8 +-
 nbd/nbd-internal.h             |   3 +-
 qapi-schema.json               |   5 +
 qemu-char.c                    |  18 +--
 tests/test-io-channel-socket.c |   5 +-
 tests/test-io-channel-tls.c    |   5 +-
 tests/test-io-task.c           |  31 ++---
 ui/vnc-auth-vencrypt.c         |   7 +-
 ui/vnc-ws.c                    |  14 ++-
 util/qemu-sockets.c            |   7 +-
 22 files changed, 745 insertions(+), 168 deletions(-)
 create mode 100644 include/io/dns-resolver.h
 create mode 100644 io/dns-resolver.c

-- 
2.9.3

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2017-01-06 12:19 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-05 16:03 [Qemu-devel] [PATCH 0/8] io: enable DNS resolving separately of socket create Daniel P. Berrange
2017-01-05 16:03 ` [Qemu-devel] [PATCH 1/8] sockets: add ability to disable DNS resolution for InetSocketAddress Daniel P. Berrange
2017-01-05 16:22   ` Eric Blake
2017-01-05 16:42     ` Daniel P. Berrange
2017-01-05 16:03 ` [Qemu-devel] [PATCH 2/8] io: stop incrementing reference in qio_task_get_source Daniel P. Berrange
2017-01-05 16:30   ` Eric Blake
2017-01-05 16:03 ` [Qemu-devel] [PATCH 3/8] io: fix typo in docs for QIOTask Daniel P. Berrange
2017-01-05 20:29   ` Eric Blake
2017-01-05 16:03 ` [Qemu-devel] [PATCH 4/8] io: add ability to associate an opaque "result" with with a task Daniel P. Berrange
2017-01-05 20:32   ` Eric Blake
2017-01-06  9:14     ` Daniel P. Berrange
2017-01-05 16:03 ` [Qemu-devel] [PATCH 5/8] io: add ability to associate an error " Daniel P. Berrange
2017-01-05 21:03   ` Eric Blake
2017-01-06  9:16     ` Daniel P. Berrange
2017-01-05 16:03 ` [Qemu-devel] [PATCH 6/8] io: change the QIOTask callback signature Daniel P. Berrange
2017-01-05 21:47   ` Eric Blake
2017-01-06 12:05     ` Daniel P. Berrange
2017-01-05 16:03 ` [Qemu-devel] [PATCH 7/8] io: remove Error parameter from QIOTask thread worker Daniel P. Berrange
2017-01-05 22:09   ` Eric Blake
2017-01-05 16:03 ` [Qemu-devel] [PATCH 8/8] io: introduce a DNS resolver API Daniel P. Berrange
2017-01-05 22:51   ` Eric Blake
2017-01-06 12:19     ` Daniel P. Berrange

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.