+ /* Do reverse lookup if we want hostname too. */
+ if (hostname) {
+ /* Get host by address */
+ if (!silc_net_gethostbyaddr(*ip, host, sizeof(host)))
+ return FALSE;
+
+ *hostname = silc_memdup(host, strlen(host));
+ SILC_LOG_DEBUG(("Resolved hostname `%s'", *hostname));
+
+ /* Reverse */
+ if (!silc_net_gethostbyname(*hostname, TRUE, host, sizeof(host)))
+ return FALSE;
+
+ if (strcmp(*ip, host))
+ return FALSE;
+ }
+
+ SILC_LOG_DEBUG(("Resolved IP address `%s'", *ip));