- if (!(hp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET))) {
- xlog(L_ERROR, "can't get hostname of %s", inet_ntoa(addr));
+ hostname = host_canonname((struct sockaddr *)sin);
+ if (hostname == NULL) {
+ char buf[INET_ADDRSTRLEN];
+ xlog(L_ERROR, "can't get hostname of %s",
+ host_ntop((struct sockaddr *)sin, buf, sizeof(buf)));