Fix setting parameters for getipnodebyaddr(3):

o "struct addrinfo" contains a pointer to "struct sockaddr,"
  not "struct sockaddr" itself
o the function takes a pointer to "struct in*_addr", not to
  "struct sockaddr," so the address length must be corresponding

MFC after:	1 week
This commit is contained in:
Yaroslav Tykhiy 2002-07-17 19:07:07 +00:00
parent 0055e2cd0b
commit 4b4cc4c60b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100259

View File

@ -787,12 +787,12 @@ inithosts(void)
/* XXX: getaddrinfo() can't do alias check */
switch(hrp->hostinfo->ai_family) {
case AF_INET:
addr = &((struct sockaddr_in *)&hrp->hostinfo->ai_addr)->sin_addr;
addrsize = sizeof(struct sockaddr_in);
addr = &((struct sockaddr_in *)hrp->hostinfo->ai_addr)->sin_addr;
addrsize = sizeof(struct in_addr);
break;
case AF_INET6:
addr = &((struct sockaddr_in6 *)&hrp->hostinfo->ai_addr)->sin6_addr;
addrsize = sizeof(struct sockaddr_in6);
addr = &((struct sockaddr_in6 *)hrp->hostinfo->ai_addr)->sin6_addr;
addrsize = sizeof(struct in6_addr);
break;
default:
/* should not reach here */