From: "Daniel P. Berrange" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v2 0/8] io: enable DNS resolving separately of socket create
Date: Mon, 9 Jan 2017 15:39:06 +0000 [thread overview]
Message-ID: <20170109153914.27424-1-berrange@redhat.com> (raw)
This is a followup of:
v1: https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg00574.html
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.
Changed in v2:
- Fix qapi schema version annotation (Eric)
- Fix qapi schema optional status for "numeric" (Eric)
- Use bool instead of gboolean (Eric)
- Document that qio_task_set_error() accepts NULL (Eric)
- Make qio_task_set_error() calls unconditional (Eric)
- Fix leak of SocketAddress results (Eric)
- Other misc typos (Eric)
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 | 228 +++++++++++++++++++++++++++++++++++
include/io/task.h | 154 +++++++++++++++++-------
include/qemu/sockets.h | 2 +
io/Makefile.objs | 1 +
io/channel-socket.c | 44 +++----
io/channel-tls.c | 16 +--
io/channel-websock.c | 8 +-
io/dns-resolver.c | 267 +++++++++++++++++++++++++++++++++++++++++
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, 747 insertions(+), 169 deletions(-)
create mode 100644 include/io/dns-resolver.h
create mode 100644 io/dns-resolver.c
--
2.9.3
next reply other threads:[~2017-01-09 15:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-09 15:39 Daniel P. Berrange [this message]
2017-01-09 15:39 ` [Qemu-devel] [PATCH v2 1/8] sockets: add ability to disable DNS resolution for InetSocketAddress Daniel P. Berrange
2017-01-10 14:25 ` Eric Blake
2017-01-09 15:39 ` [Qemu-devel] [PATCH v2 2/8] io: stop incrementing reference in qio_task_get_source Daniel P. Berrange
2017-01-09 15:39 ` [Qemu-devel] [PATCH v2 3/8] io: fix typo in docs for QIOTask Daniel P. Berrange
2017-01-09 15:39 ` [Qemu-devel] [PATCH v2 4/8] io: add ability to associate an opaque "result" with with a task Daniel P. Berrange
2017-01-09 15:39 ` [Qemu-devel] [PATCH v2 5/8] io: add ability to associate an error " Daniel P. Berrange
2017-01-10 14:55 ` Eric Blake
2017-01-09 15:39 ` [Qemu-devel] [PATCH v2 6/8] io: change the QIOTask callback signature Daniel P. Berrange
2017-01-09 15:39 ` [Qemu-devel] [PATCH v2 7/8] io: remove Error parameter from QIOTask thread worker Daniel P. Berrange
2017-01-09 15:39 ` [Qemu-devel] [PATCH v2 8/8] io: introduce a DNS resolver API Daniel P. Berrange
2017-01-10 15:01 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170109153914.27424-1-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).