ares_getaddrinfo(): duplicate hints ai_socktype and ai_protocol into output

ai_socktype and ai_protocol were ignored from the hints input.  They are now
duplicated into the output as expected.  Currently no sanity checks on
proper values are taking place.

Fixes: #317
Fix By: Brad House (@bradh352)
pull/372/head
bradh352 4 years ago
parent 0d252eb3b2
commit 420820767a
  1. 5
      src/lib/ares_getaddrinfo.c

@ -386,6 +386,9 @@ static int fake_addrinfo(const char *name,
}
}
node->ai_socktype = hints->ai_socktype;
node->ai_protocol = hints->ai_protocol;
callback(arg, ARES_SUCCESS, 0, ai);
return 1;
}
@ -406,6 +409,8 @@ static void end_hquery(struct host_query *hquery, int status)
/* Set port into each address (resolved separately). */
while (next)
{
next->ai_socktype = hquery->hints.ai_socktype;
next->ai_protocol = hquery->hints.ai_protocol;
if (next->ai_family == AF_INET)
{
(CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr))->sin_port = htons(hquery->port);

Loading…
Cancel
Save