- asprintf(&(c->address), " = ntohl(ci.sin_addr.s_addr);
- c->hostname = hostlookup(ci.sin_addr.s_addr);
+ c->address = sockaddr_to_addrinfo(ci);
+
+ c->hostname = xmalloc(INET6_ADDRSTRLEN);
+ if((inet_ntop(ci.sin_family, &(ci.sin_addr), c->hostname, INET6_ADDRSTRLEN)) == NULL)
+ {
+ syslog(LOG_ERR, _("Couldn't convert address to string: %m"));
+ free(c->hostname);
+ return NULL;
+ }