Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <config.h>
+
+#ifndef WINDOWS
#include <netdb.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
void
address_list_copy_one (struct address_list *al, int index, ip_address *ip_store)
{
- assert (index >= al->faulty && index < al->count && ip_store!=NULL );
+ assert (index >= al->faulty && index < al->count);
memcpy (ip_store, al->addresses + index, sizeof (ip_address));
}
for (i = 0, ai = ai_head; ai; ai = ai->ai_next)
if (ai->ai_family == AF_INET6)
{
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)ai->ai_addr;
+ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)ai->ai_addr;
memcpy (al->addresses + i, &sin6->sin6_addr, 16);
++i;
}
{
if (ip_family == AF_INET)
{
- ip4_address addr4;
- if (!map_ip_to_ipv4 (addr, &addr4))
- /* should the callers have prevented this? */
- abort ();
sa->sin.sin_family = ip_family;
sa->sin.sin_port = htons (port);
if (addr == NULL)
memset (&sa->sin.sin_addr, 0, sizeof(ip4_address));
- else
- memcpy (&sa->sin.sin_addr, &addr4, sizeof(ip4_address));
+ else
+ {
+ ip4_address addr4;
+ if (!map_ip_to_ipv4 (addr, &addr4))
+ /* should the callers have prevented this? */
+ abort ();
+ memcpy (&sa->sin.sin_addr, &addr4, sizeof(ip4_address));
+ }
return;
}
#ifdef INET6
if (!silent)
logprintf (LOG_VERBOSE, _("Resolving %s... "), host);
+ /* Host name lookup goes on below. #### We should implement
+ getaddrinfo_with_timeout and gethostbyname_with_timeout the same
+ way connect.c implements connect_with_timeout. */
+
#ifdef INET6
{
struct addrinfo hints, *ai;