Import IPv6 update from devel

This commit is contained in:
Kurt Zeilenga 2000-08-24 23:25:09 +00:00
parent e7dd5eecd8
commit 6e3df3e610

View File

@ -907,14 +907,22 @@ slapd_daemon_task(
#endif /* LDAP_PF_LOCAL */ #endif /* LDAP_PF_LOCAL */
# ifdef LDAP_PF_INET6 # ifdef LDAP_PF_INET6
case AF_INET6: { case AF_INET6:
if ( IN6_IS_ADDR_V4MAPPED(&from.sa_in6_addr.sin6_addr) ) {
peeraddr = inet_ntoa( *((struct in_addr *)
&from.sa_in6_addr.sin6_addr.s6_addr32[3]) );
sprintf( peername, "IP=%s:%d",
peeraddr != NULL ? peeraddr : "unknown",
(unsigned) ntohs( from.sa_in6_addr.sin6_port ) );
} else {
char addr[INET6_ADDRSTRLEN]; char addr[INET6_ADDRSTRLEN];
sprintf( peername, "IP=%s %d", sprintf( peername, "IP=%s %d",
inet_ntop( AF_INET6, inet_ntop( AF_INET6,
&from.sa_in6_addr.sin6_addr, &from.sa_in6_addr.sin6_addr,
addr, sizeof addr) ? addr : "unknown", addr, sizeof addr) ? addr : "unknown",
(unsigned) ntohs( from.sa_in6_addr.sin6_port ) ); (unsigned) ntohs( from.sa_in6_addr.sin6_port ) );
} break; }
break;
# endif /* LDAP_PF_INET6 */ # endif /* LDAP_PF_INET6 */
case AF_INET: case AF_INET: