"Robert P. J. Day" | 63fc1a9 | 2006-07-02 19:47:05 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 2 | /* |
| 3 | * stolen from net-tools-1.59 and stripped down for busybox by |
Eric Andersen | cb81e64 | 2003-07-14 21:21:08 +0000 | [diff] [blame] | 4 | * Erik Andersen <andersen@codepoet.org> |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 5 | * |
| 6 | * Heavily modified by Manuel Novoa III Mar 12, 2001 |
| 7 | * |
Denys Vlasenko | 0ef64bd | 2010-08-16 20:14:46 +0200 | [diff] [blame] | 8 | * Licensed under GPLv2, see file LICENSE in this source tree. |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
Rob Landley | ea224be | 2006-06-18 20:20:07 +0000 | [diff] [blame] | 11 | #include "libbb.h" |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 12 | #include "inet_common.h" |
Eric Andersen | 77d22c4 | 2002-06-06 12:11:55 +0000 | [diff] [blame] | 13 | |
Denis Vlasenko | defc1ea | 2008-06-27 02:52:20 +0000 | [diff] [blame] | 14 | int FAST_FUNC INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst) |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 15 | { |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 16 | struct hostent *hp; |
Denis Vlasenko | a61cb92 | 2007-06-19 11:24:47 +0000 | [diff] [blame] | 17 | #if ENABLE_FEATURE_ETC_NETWORKS |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 18 | struct netent *np; |
Denis Vlasenko | a61cb92 | 2007-06-19 11:24:47 +0000 | [diff] [blame] | 19 | #endif |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 20 | |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 21 | /* Grmpf. -FvK */ |
| 22 | s_in->sin_family = AF_INET; |
| 23 | s_in->sin_port = 0; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 24 | |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 25 | /* Default is special, meaning 0.0.0.0. */ |
Denys Vlasenko | 0004e99 | 2010-09-01 12:01:17 +0200 | [diff] [blame^] | 26 | if (strcmp(name, "default") == 0) { |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 27 | s_in->sin_addr.s_addr = INADDR_ANY; |
Denis Vlasenko | 7ca3921 | 2006-11-21 20:34:21 +0000 | [diff] [blame] | 28 | return 1; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 29 | } |
| 30 | /* Look to see if it's a dotted quad. */ |
| 31 | if (inet_aton(name, &s_in->sin_addr)) { |
| 32 | return 0; |
| 33 | } |
| 34 | /* If we expect this to be a hostname, try hostname database first */ |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 35 | #ifdef DEBUG |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 36 | if (hostfirst) { |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 37 | bb_error_msg("gethostbyname(%s)", name); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 38 | } |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 39 | #endif |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 40 | if (hostfirst) { |
| 41 | hp = gethostbyname(name); |
| 42 | if (hp != NULL) { |
| 43 | memcpy(&s_in->sin_addr, hp->h_addr_list[0], |
| 44 | sizeof(struct in_addr)); |
| 45 | return 0; |
| 46 | } |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 47 | } |
Denis Vlasenko | a61cb92 | 2007-06-19 11:24:47 +0000 | [diff] [blame] | 48 | #if ENABLE_FEATURE_ETC_NETWORKS |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 49 | /* Try the NETWORKS database to see if this is a known network. */ |
| 50 | #ifdef DEBUG |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 51 | bb_error_msg("getnetbyname(%s)", name); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 52 | #endif |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 53 | np = getnetbyname(name); |
| 54 | if (np != NULL) { |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 55 | s_in->sin_addr.s_addr = htonl(np->n_net); |
| 56 | return 1; |
| 57 | } |
Denis Vlasenko | a61cb92 | 2007-06-19 11:24:47 +0000 | [diff] [blame] | 58 | #endif |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 59 | if (hostfirst) { |
| 60 | /* Don't try again */ |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 61 | return -1; |
| 62 | } |
| 63 | #ifdef DEBUG |
| 64 | res_init(); |
| 65 | _res.options |= RES_DEBUG; |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 66 | bb_error_msg("gethostbyname(%s)", name); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 67 | #endif |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 68 | hp = gethostbyname(name); |
| 69 | if (hp == NULL) { |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 70 | return -1; |
| 71 | } |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 72 | memcpy(&s_in->sin_addr, hp->h_addr_list[0], sizeof(struct in_addr)); |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 73 | return 0; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 74 | } |
| 75 | |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 76 | |
| 77 | /* numeric: & 0x8000: default instead of *, |
| 78 | * & 0x4000: host instead of net, |
| 79 | * & 0x0fff: don't resolve |
| 80 | */ |
Denis Vlasenko | defc1ea | 2008-06-27 02:52:20 +0000 | [diff] [blame] | 81 | char* FAST_FUNC INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t netmask) |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 82 | { |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 83 | /* addr-to-name cache */ |
| 84 | struct addr { |
| 85 | struct addr *next; |
| 86 | struct sockaddr_in addr; |
| 87 | int host; |
| 88 | char name[1]; |
| 89 | }; |
| 90 | static struct addr *cache = NULL; |
| 91 | |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 92 | struct addr *pn; |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 93 | char *name; |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 94 | uint32_t ad, host_ad; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 95 | int host = 0; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 96 | |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 97 | if (s_in->sin_family != AF_INET) { |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 98 | #ifdef DEBUG |
Denis Vlasenko | 1b16bda | 2007-06-19 11:10:02 +0000 | [diff] [blame] | 99 | bb_error_msg("rresolve: unsupported address family %d!", |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 100 | s_in->sin_family); |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 101 | #endif |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 102 | errno = EAFNOSUPPORT; |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 103 | return NULL; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 104 | } |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 105 | ad = s_in->sin_addr.s_addr; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 106 | #ifdef DEBUG |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 107 | bb_error_msg("rresolve: %08x, mask %08x, num %08x", (unsigned)ad, netmask, numeric); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 108 | #endif |
| 109 | if (ad == INADDR_ANY) { |
| 110 | if ((numeric & 0x0FFF) == 0) { |
| 111 | if (numeric & 0x8000) |
Denys Vlasenko | 0004e99 | 2010-09-01 12:01:17 +0200 | [diff] [blame^] | 112 | return xstrdup("default"); |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 113 | return xstrdup("*"); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 114 | } |
| 115 | } |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 116 | if (numeric & 0x0FFF) |
| 117 | return xstrdup(inet_ntoa(s_in->sin_addr)); |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 118 | |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 119 | if ((ad & (~netmask)) != 0 || (numeric & 0x4000)) |
| 120 | host = 1; |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 121 | pn = cache; |
| 122 | while (pn) { |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 123 | if (pn->addr.sin_addr.s_addr == ad && pn->host == host) { |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 124 | #ifdef DEBUG |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 125 | bb_error_msg("rresolve: found %s %08x in cache", |
| 126 | (host ? "host" : "net"), (unsigned)ad); |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 127 | #endif |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 128 | return xstrdup(pn->name); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 129 | } |
| 130 | pn = pn->next; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 131 | } |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 132 | |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 133 | host_ad = ntohl(ad); |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 134 | name = NULL; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 135 | if (host) { |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 136 | struct hostent *ent; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 137 | #ifdef DEBUG |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 138 | bb_error_msg("gethostbyaddr (%08x)", (unsigned)ad); |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 139 | #endif |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 140 | ent = gethostbyaddr((char *) &ad, 4, AF_INET); |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 141 | if (ent) |
| 142 | name = xstrdup(ent->h_name); |
Denis Vlasenko | a61cb92 | 2007-06-19 11:24:47 +0000 | [diff] [blame] | 143 | } else if (ENABLE_FEATURE_ETC_NETWORKS) { |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 144 | struct netent *np; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 145 | #ifdef DEBUG |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 146 | bb_error_msg("getnetbyaddr (%08x)", (unsigned)host_ad); |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 147 | #endif |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 148 | np = getnetbyaddr(host_ad, AF_INET); |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 149 | if (np) |
| 150 | name = xstrdup(np->n_name); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 151 | } |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 152 | if (!name) |
| 153 | name = xstrdup(inet_ntoa(s_in->sin_addr)); |
| 154 | pn = xmalloc(sizeof(*pn) + strlen(name)); /* no '+ 1', it's already accounted for */ |
| 155 | pn->next = cache; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 156 | pn->addr = *s_in; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 157 | pn->host = host; |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 158 | strcpy(pn->name, name); |
| 159 | cache = pn; |
| 160 | return name; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 161 | } |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 162 | |
Denis Vlasenko | e324184 | 2007-08-13 10:36:25 +0000 | [diff] [blame] | 163 | #if ENABLE_FEATURE_IPV6 |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 164 | |
Denis Vlasenko | defc1ea | 2008-06-27 02:52:20 +0000 | [diff] [blame] | 165 | int FAST_FUNC INET6_resolve(const char *name, struct sockaddr_in6 *sin6) |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 166 | { |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 167 | struct addrinfo req, *ai; |
| 168 | int s; |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 169 | |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 170 | memset(&req, '\0', sizeof req); |
| 171 | req.ai_family = AF_INET6; |
Denis Vlasenko | 7ca3921 | 2006-11-21 20:34:21 +0000 | [diff] [blame] | 172 | s = getaddrinfo(name, NULL, &req, &ai); |
| 173 | if (s) { |
Manuel Novoa III | cad5364 | 2003-03-19 09:13:01 +0000 | [diff] [blame] | 174 | bb_error_msg("getaddrinfo: %s: %d", name, s); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 175 | return -1; |
| 176 | } |
| 177 | memcpy(sin6, ai->ai_addr, sizeof(struct sockaddr_in6)); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 178 | freeaddrinfo(ai); |
Denis Vlasenko | 7ca3921 | 2006-11-21 20:34:21 +0000 | [diff] [blame] | 179 | return 0; |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 180 | } |
| 181 | |
| 182 | #ifndef IN6_IS_ADDR_UNSPECIFIED |
Glenn L McGrath | d7fb1b3 | 2002-11-26 02:40:56 +0000 | [diff] [blame] | 183 | # define IN6_IS_ADDR_UNSPECIFIED(a) \ |
Bernhard Reutner-Fischer | 38583fd | 2006-05-19 12:44:16 +0000 | [diff] [blame] | 184 | (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \ |
| 185 | ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0) |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 186 | #endif |
| 187 | |
| 188 | |
Denis Vlasenko | defc1ea | 2008-06-27 02:52:20 +0000 | [diff] [blame] | 189 | char* FAST_FUNC INET6_rresolve(struct sockaddr_in6 *sin6, int numeric) |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 190 | { |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 191 | char name[128]; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 192 | int s; |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 193 | |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 194 | if (sin6->sin6_family != AF_INET6) { |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 195 | #ifdef DEBUG |
Denys Vlasenko | bcbd37d | 2009-06-18 13:23:58 +0200 | [diff] [blame] | 196 | bb_error_msg("rresolve: unsupported address family %d!", |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 197 | sin6->sin6_family); |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 198 | #endif |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 199 | errno = EAFNOSUPPORT; |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 200 | return NULL; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 201 | } |
| 202 | if (numeric & 0x7FFF) { |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 203 | inet_ntop(AF_INET6, &sin6->sin6_addr, name, sizeof(name)); |
| 204 | return xstrdup(name); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 205 | } |
| 206 | if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 207 | if (numeric & 0x8000) |
Denys Vlasenko | 0004e99 | 2010-09-01 12:01:17 +0200 | [diff] [blame^] | 208 | return xstrdup("default"); |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 209 | return xstrdup("*"); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 210 | } |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 211 | |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 212 | s = getnameinfo((struct sockaddr *) sin6, sizeof(struct sockaddr_in6), |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 213 | name, sizeof(name), NULL, 0, 0); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 214 | if (s) { |
Manuel Novoa III | cad5364 | 2003-03-19 09:13:01 +0000 | [diff] [blame] | 215 | bb_error_msg("getnameinfo failed"); |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 216 | return NULL; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 217 | } |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 218 | return xstrdup(name); |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 219 | } |
| 220 | |
Denis Vlasenko | a5549c9 | 2008-01-24 22:49:15 +0000 | [diff] [blame] | 221 | #endif /* CONFIG_FEATURE_IPV6 */ |