Hint getaddrinfo() correctly if we're looking up a name that we got from
an AF_INET6 address. MFC after: 1 week
This commit is contained in:
parent
a5dd141db6
commit
3ee63d3929
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=80056
@ -102,8 +102,15 @@ realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, int addrlen)
|
||||
struct sockaddr *sa;
|
||||
|
||||
memset(&hints, 0, sizeof(struct addrinfo));
|
||||
hints.ai_family =
|
||||
(addr->sa_family == AF_INET) ? AF_INET : AF_UNSPEC;
|
||||
switch (addr->sa_family) {
|
||||
case AF_INET:
|
||||
case AF_INET6:
|
||||
hints.ai_family = addr->sa_family;
|
||||
break;
|
||||
default:
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
break;
|
||||
}
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
|
||||
error = getaddrinfo(buf, NULL, &hints, &res);
|
||||
|
Loading…
Reference in New Issue
Block a user