diff options
Diffstat (limited to 'src/lib/libc')
| -rw-r--r-- | src/lib/libc/net/getaddrinfo.c | 56 | ||||
| -rw-r--r-- | src/lib/libc/net/getnameinfo.c | 25 |
2 files changed, 2 insertions, 79 deletions
diff --git a/src/lib/libc/net/getaddrinfo.c b/src/lib/libc/net/getaddrinfo.c index 9c89de2863..3fa1ce01d4 100644 --- a/src/lib/libc/net/getaddrinfo.c +++ b/src/lib/libc/net/getaddrinfo.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: getaddrinfo.c,v 1.5 1999/12/30 08:54:20 itojun Exp $ */ | 1 | /* $OpenBSD: getaddrinfo.c,v 1.6 2000/01/17 08:15:26 itojun Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
| @@ -47,20 +47,10 @@ | |||
| 47 | * in ai_flags? | 47 | * in ai_flags? |
| 48 | */ | 48 | */ |
| 49 | 49 | ||
| 50 | #if 0 | ||
| 51 | #ifdef HAVE_CONFIG_H | ||
| 52 | #include "config.h" | ||
| 53 | #endif | ||
| 54 | #else | ||
| 55 | #define HAVE_SOCKADDR_SA_LEN | ||
| 56 | #define INET6 | 50 | #define INET6 |
| 57 | #endif | ||
| 58 | 51 | ||
| 59 | #include <sys/types.h> | 52 | #include <sys/types.h> |
| 60 | #include <sys/param.h> | 53 | #include <sys/param.h> |
| 61 | #if 0 | ||
| 62 | #include <sys/sysctl.h> | ||
| 63 | #endif | ||
| 64 | #include <sys/socket.h> | 54 | #include <sys/socket.h> |
| 65 | #include <net/if.h> | 55 | #include <net/if.h> |
| 66 | #include <netinet/in.h> | 56 | #include <netinet/in.h> |
| @@ -76,28 +66,6 @@ | |||
| 76 | #include <stdio.h> | 66 | #include <stdio.h> |
| 77 | #include <errno.h> | 67 | #include <errno.h> |
| 78 | 68 | ||
| 79 | #if 0 | ||
| 80 | #ifndef HAVE_PORTABLE_PROTOTYPE | ||
| 81 | #include "cdecl_ext.h" | ||
| 82 | #endif | ||
| 83 | |||
| 84 | #ifndef HAVE_U_INT32_T | ||
| 85 | #include "bittypes.h" | ||
| 86 | #endif | ||
| 87 | |||
| 88 | #ifndef HAVE_SOCKADDR_STORAGE | ||
| 89 | #include "sockstorage.h" | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #ifndef HAVE_ADDRINFO | ||
| 93 | #include "addrinfo.h" | ||
| 94 | #endif | ||
| 95 | |||
| 96 | #if defined(__KAME__) && defined(INET6) | ||
| 97 | # define FAITH | ||
| 98 | #endif | ||
| 99 | #endif | ||
| 100 | |||
| 101 | #define SUCCESS 0 | 69 | #define SUCCESS 0 |
| 102 | #define ANY 0 | 70 | #define ANY 0 |
| 103 | #define YES 1 | 71 | #define YES 1 |
| @@ -198,26 +166,6 @@ static int get_portmatch __P((const struct addrinfo *, const char *)); | |||
| 198 | static int get_port __P((struct addrinfo *, const char *, int)); | 166 | static int get_port __P((struct addrinfo *, const char *, int)); |
| 199 | static const struct afd *find_afd __P((int)); | 167 | static const struct afd *find_afd __P((int)); |
| 200 | 168 | ||
| 201 | #if 0 | ||
| 202 | static char *ai_errlist[] = { | ||
| 203 | "Success", | ||
| 204 | "Address family for hostname not supported", /* EAI_ADDRFAMILY */ | ||
| 205 | "Temporary failure in name resolution", /* EAI_AGAIN */ | ||
| 206 | "Invalid value for ai_flags", /* EAI_BADFLAGS */ | ||
| 207 | "Non-recoverable failure in name resolution", /* EAI_FAIL */ | ||
| 208 | "ai_family not supported", /* EAI_FAMILY */ | ||
| 209 | "Memory allocation failure", /* EAI_MEMORY */ | ||
| 210 | "No address associated with hostname", /* EAI_NODATA */ | ||
| 211 | "hostname nor servname provided, or not known", /* EAI_NONAME */ | ||
| 212 | "servname not supported for ai_socktype", /* EAI_SERVICE */ | ||
| 213 | "ai_socktype not supported", /* EAI_SOCKTYPE */ | ||
| 214 | "System error returned in errno", /* EAI_SYSTEM */ | ||
| 215 | "Invalid value for hints", /* EAI_BADHINTS */ | ||
| 216 | "Resolved protocol is unknown", /* EAI_PROTOCOL */ | ||
| 217 | "Unknown error", /* EAI_MAX */ | ||
| 218 | }; | ||
| 219 | #endif | ||
| 220 | |||
| 221 | /* XXX macros that make external reference is BAD. */ | 169 | /* XXX macros that make external reference is BAD. */ |
| 222 | 170 | ||
| 223 | #define GET_AI(ai, afd, addr) \ | 171 | #define GET_AI(ai, afd, addr) \ |
| @@ -977,9 +925,7 @@ get_ai(pai, afd, addr) | |||
| 977 | memcpy(ai, pai, sizeof(struct addrinfo)); | 925 | memcpy(ai, pai, sizeof(struct addrinfo)); |
| 978 | ai->ai_addr = (struct sockaddr *)(ai + 1); | 926 | ai->ai_addr = (struct sockaddr *)(ai + 1); |
| 979 | memset(ai->ai_addr, 0, afd->a_socklen); | 927 | memset(ai->ai_addr, 0, afd->a_socklen); |
| 980 | #ifdef HAVE_SOCKADDR_SA_LEN | ||
| 981 | ai->ai_addr->sa_len = afd->a_socklen; | 928 | ai->ai_addr->sa_len = afd->a_socklen; |
| 982 | #endif | ||
| 983 | ai->ai_addrlen = afd->a_socklen; | 929 | ai->ai_addrlen = afd->a_socklen; |
| 984 | ai->ai_addr->sa_family = ai->ai_family = afd->a_af; | 930 | ai->ai_addr->sa_family = ai->ai_family = afd->a_af; |
| 985 | p = (char *)(ai->ai_addr); | 931 | p = (char *)(ai->ai_addr); |
diff --git a/src/lib/libc/net/getnameinfo.c b/src/lib/libc/net/getnameinfo.c index 000ce85523..8b2ca299ef 100644 --- a/src/lib/libc/net/getnameinfo.c +++ b/src/lib/libc/net/getnameinfo.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: getnameinfo.c,v 1.6 2000/01/05 04:50:48 itojun Exp $ */ | 1 | /* $OpenBSD: getnameinfo.c,v 1.7 2000/01/17 08:15:27 itojun Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
| @@ -39,14 +39,7 @@ | |||
| 39 | * modified). | 39 | * modified). |
| 40 | */ | 40 | */ |
| 41 | 41 | ||
| 42 | #if 0 | ||
| 43 | #ifdef HAVE_CONFIG_H | ||
| 44 | #include "config.h" | ||
| 45 | #endif | ||
| 46 | #else | ||
| 47 | #define HAVE_SA_LEN | ||
| 48 | #define INET6 | 42 | #define INET6 |
| 49 | #endif | ||
| 50 | 43 | ||
| 51 | #include <sys/types.h> | 44 | #include <sys/types.h> |
| 52 | #include <sys/socket.h> | 45 | #include <sys/socket.h> |
| @@ -59,16 +52,6 @@ | |||
| 59 | #include <string.h> | 52 | #include <string.h> |
| 60 | #include <stddef.h> | 53 | #include <stddef.h> |
| 61 | 54 | ||
| 62 | #if 0 | ||
| 63 | #ifndef HAVE_PORTABLE_PROTOTYPE | ||
| 64 | #include "cdecl_ext.h" | ||
| 65 | #endif | ||
| 66 | |||
| 67 | #ifndef HAVE_ADDRINFO | ||
| 68 | #include "addrinfo.h" | ||
| 69 | #endif | ||
| 70 | #endif | ||
| 71 | |||
| 72 | #define SUCCESS 0 | 55 | #define SUCCESS 0 |
| 73 | #define ANY 0 | 56 | #define ANY 0 |
| 74 | #define YES 1 | 57 | #define YES 1 |
| @@ -127,10 +110,8 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) | |||
| 127 | if (sa == NULL) | 110 | if (sa == NULL) |
| 128 | return ENI_NOSOCKET; | 111 | return ENI_NOSOCKET; |
| 129 | 112 | ||
| 130 | #ifdef HAVE_SA_LEN /*XXX*/ | ||
| 131 | if (sa->sa_len != salen) | 113 | if (sa->sa_len != salen) |
| 132 | return ENI_SALEN; | 114 | return ENI_SALEN; |
| 133 | #endif | ||
| 134 | 115 | ||
| 135 | family = sa->sa_family; | 116 | family = sa->sa_family; |
| 136 | for (i = 0; afdl[i].a_af; i++) | 117 | for (i = 0; afdl[i].a_af; i++) |
| @@ -180,11 +161,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) | |||
| 180 | if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a)) | 161 | if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a)) |
| 181 | flags |= NI_NUMERICHOST; | 162 | flags |= NI_NUMERICHOST; |
| 182 | v4a >>= IN_CLASSA_NSHIFT; | 163 | v4a >>= IN_CLASSA_NSHIFT; |
| 183 | #if 0 | ||
| 184 | if (v4a == 0 || v4a == IN_LOOPBACKNET) | ||
| 185 | #else | ||
| 186 | if (v4a == 0) | 164 | if (v4a == 0) |
| 187 | #endif | ||
| 188 | flags |= NI_NUMERICHOST; | 165 | flags |= NI_NUMERICHOST; |
| 189 | break; | 166 | break; |
| 190 | #ifdef INET6 | 167 | #ifdef INET6 |
