log_d("dnslookup: %s", message); log_d("name=%s", tmp); log_d("address=%s", inet_ntoa(ia));
log_d("dnslookup: %s, address=%s, name=%s", message, inet_ntoa(ia), tmp);
static char *dnslookup(struct in_addr ia, int level){	char **al;	struct hostent *h;	const char *message;	char *tmp;	if (level == 0)		return 0;	if (debug)		log_d("dnslookup: gethostbyaddr(%s)", inet_ntoa(ia));	h = gethostbyaddr((char *) &ia, sizeof ia, AF_INET);	if (h == 0 || h->h_name == 0)		return 0;	tmp = strdup(h->h_name);	if (tmp == 0) {		log_d("dnslookup: strdup failed");		return 0;	}	if (level <= 1)		return tmp;	message = "name does not match address";	if (debug)		log_d("dnslookup: gethostbyname(\"%s\")", tmp);	h = gethostbyname(tmp);	if (h == 0)		message = "host not found";	else if (h->h_name == 0)		message = "h_name == 0";	else if (level > 2 && strcasecmp(h->h_name, tmp))		message = "name not canonical";	else if (h->h_addrtype != AF_INET)		message = "h_addrtype != AF_INET";	else if (h->h_length != sizeof ia)		message = "h_length != sizeof (struct in_addr)";	else {		for (al = h->h_addr_list; *al; al++) {			if (memcmp(*al, &ia, sizeof ia) == 0) {				message = 0;				break;			}		}	}	if (message) {		log_d("dnslookup: %s", message);		log_d("name=%s", tmp);		log_d("address=%s", inet_ntoa(ia));		free(tmp);		return 0;	}	return tmp;}