-/* $OpenBSD: getaddrinfo.c,v 1.21 2000/04/26 16:05:20 itojun Exp $ */
-/* $KAME: getaddrinfo.c,v 1.14 2000/04/26 15:41:49 itojun Exp $ */
+/* $OpenBSD: getaddrinfo.c,v 1.22 2000/04/27 05:30:23 itojun Exp $ */
+/* $KAME: getaddrinfo.c,v 1.16 2000/04/27 03:37:43 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
static const char in6_addrany[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-static const char in_loopback[] = { 127, 0, 0, 1 };
+static const char in_loopback[] = { 127, 0, 0, 1 };
static const char in6_loopback[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
};
-struct sockinet {
- u_char si_len;
- u_char si_family;
- u_short si_port;
- u_int32_t si_scope_id;
-};
-
static const struct afd {
int a_af;
int a_addrlen;
#endif
#ifdef INET6
static int ip6_str2scopeid __P((char *, struct sockaddr_in6 *));
-#endif
+#endif
static void _sethtent __P((void));
static void _endhtent __P((void));
return 0;
afd = find_afd(pai->ai_family);
+ if (afd == NULL)
+ return 0;
if (pai->ai_flags & AI_PASSIVE) {
GET_AI(cur->ai_next, afd, afd->a_addrany);
return 0;
afd = find_afd(pai->ai_family);
+ if (afd == NULL)
+ return 0;
switch (afd->a_af) {
#if 0 /*X/Open spec*/
GET_PORT(cur->ai_next, servname);
while (cur && cur->ai_next)
cur = cur->ai_next;
- } else
+ } else
ERR(EAI_FAMILY); /*xxx*/
}
break;
GET_PORT(cur->ai_next, servname);
while (cur && cur->ai_next)
cur = cur->ai_next;
- } else
+ } else
ERR(EAI_FAMILY); /*xxx*/
}
break;
return 0;
afd = find_afd(pai->ai_family);
+ if (afd == NULL)
+ return 0;
+
if (!afd->a_scoped)
return explore_numeric(pai, hostname, servname, res);
else
return -1;
}
-#endif
+#endif
/* code duplicate with gethnamaddr.c */