aboutsummaryrefslogtreecommitdiff
path: root/io
diff options
context:
space:
mode:
Diffstat (limited to 'io')
-rw-r--r--io/dns-resolver.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/io/dns-resolver.c b/io/dns-resolver.c
index 759d1b40d7..57a8896cbb 100644
--- a/io/dns-resolver.c
+++ b/io/dns-resolver.c
@@ -51,7 +51,7 @@ static int qio_dns_resolver_lookup_sync_inet(QIODNSResolver *resolver,
Error **errp)
{
struct addrinfo ai, *res, *e;
- InetSocketAddress *iaddr = addr->u.inet.data;
+ InetSocketAddress *iaddr = &addr->u.inet;
char port[33];
char uaddr[INET6_ADDRSTRLEN + 1];
char uport[33];
@@ -102,15 +102,14 @@ static int qio_dns_resolver_lookup_sync_inet(QIODNSResolver *resolver,
/* create socket + bind */
for (i = 0, e = res; e != NULL; i++, e = e->ai_next) {
SocketAddress *newaddr = g_new0(SocketAddress, 1);
- InetSocketAddress *newiaddr = g_new0(InetSocketAddress, 1);
- newaddr->u.inet.data = newiaddr;
- newaddr->type = SOCKET_ADDRESS_KIND_INET;
+
+ newaddr->type = SOCKET_ADDRESS_TYPE_INET;
getnameinfo((struct sockaddr *)e->ai_addr, e->ai_addrlen,
uaddr, INET6_ADDRSTRLEN, uport, 32,
NI_NUMERICHOST | NI_NUMERICSERV);
- *newiaddr = (InetSocketAddress){
+ newaddr->u.inet = (InetSocketAddress){
.host = g_strdup(uaddr),
.port = g_strdup(uport),
.has_numeric = true,
@@ -149,16 +148,16 @@ int qio_dns_resolver_lookup_sync(QIODNSResolver *resolver,
Error **errp)
{
switch (addr->type) {
- case SOCKET_ADDRESS_KIND_INET:
+ case SOCKET_ADDRESS_TYPE_INET:
return qio_dns_resolver_lookup_sync_inet(resolver,
addr,
naddrs,
addrs,
errp);
- case SOCKET_ADDRESS_KIND_UNIX:
- case SOCKET_ADDRESS_KIND_VSOCK:
- case SOCKET_ADDRESS_KIND_FD:
+ case SOCKET_ADDRESS_TYPE_UNIX:
+ case SOCKET_ADDRESS_TYPE_VSOCK:
+ case SOCKET_ADDRESS_TYPE_FD:
return qio_dns_resolver_lookup_sync_nop(resolver,
addr,
naddrs,