"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 | * |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 8 | * |
| 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. */ |
Denis Vlasenko | 7ca3921 | 2006-11-21 20:34:21 +0000 | [diff] [blame] | 26 | if (!strcmp(name, bb_str_default)) { |
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; |
| 66 | #endif |
| 67 | |
| 68 | #ifdef DEBUG |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 69 | bb_error_msg("gethostbyname(%s)", name); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 70 | #endif |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 71 | hp = gethostbyname(name); |
| 72 | if (hp == NULL) { |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 73 | return -1; |
| 74 | } |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 75 | 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] | 76 | return 0; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 77 | } |
| 78 | |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 79 | |
| 80 | /* numeric: & 0x8000: default instead of *, |
| 81 | * & 0x4000: host instead of net, |
| 82 | * & 0x0fff: don't resolve |
| 83 | */ |
Denis Vlasenko | defc1ea | 2008-06-27 02:52:20 +0000 | [diff] [blame] | 84 | 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] | 85 | { |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 86 | /* addr-to-name cache */ |
| 87 | struct addr { |
| 88 | struct addr *next; |
| 89 | struct sockaddr_in addr; |
| 90 | int host; |
| 91 | char name[1]; |
| 92 | }; |
| 93 | static struct addr *cache = NULL; |
| 94 | |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 95 | struct addr *pn; |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 96 | char *name; |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 97 | uint32_t ad, host_ad; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 98 | int host = 0; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 99 | |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 100 | if (s_in->sin_family != AF_INET) { |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 101 | #ifdef DEBUG |
Denis Vlasenko | 1b16bda | 2007-06-19 11:10:02 +0000 | [diff] [blame] | 102 | bb_error_msg("rresolve: unsupported address family %d!", |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 103 | s_in->sin_family); |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 104 | #endif |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 105 | errno = EAFNOSUPPORT; |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 106 | return NULL; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 107 | } |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 108 | ad = s_in->sin_addr.s_addr; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 109 | #ifdef DEBUG |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 110 | 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] | 111 | #endif |
| 112 | if (ad == INADDR_ANY) { |
| 113 | if ((numeric & 0x0FFF) == 0) { |
| 114 | if (numeric & 0x8000) |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 115 | return xstrdup(bb_str_default); |
| 116 | return xstrdup("*"); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 117 | } |
| 118 | } |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 119 | if (numeric & 0x0FFF) |
| 120 | return xstrdup(inet_ntoa(s_in->sin_addr)); |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 121 | |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 122 | if ((ad & (~netmask)) != 0 || (numeric & 0x4000)) |
| 123 | host = 1; |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 124 | pn = cache; |
| 125 | while (pn) { |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 126 | if (pn->addr.sin_addr.s_addr == ad && pn->host == host) { |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 127 | #ifdef DEBUG |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 128 | bb_error_msg("rresolve: found %s %08x in cache", |
| 129 | (host ? "host" : "net"), (unsigned)ad); |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 130 | #endif |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 131 | return xstrdup(pn->name); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 132 | } |
| 133 | pn = pn->next; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 134 | } |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 135 | |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 136 | host_ad = ntohl(ad); |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 137 | name = NULL; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 138 | if (host) { |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 139 | struct hostent *ent; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 140 | #ifdef DEBUG |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 141 | bb_error_msg("gethostbyaddr (%08x)", (unsigned)ad); |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 142 | #endif |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 143 | ent = gethostbyaddr((char *) &ad, 4, AF_INET); |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 144 | if (ent) |
| 145 | name = xstrdup(ent->h_name); |
Denis Vlasenko | a61cb92 | 2007-06-19 11:24:47 +0000 | [diff] [blame] | 146 | } else if (ENABLE_FEATURE_ETC_NETWORKS) { |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 147 | struct netent *np; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 148 | #ifdef DEBUG |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 149 | bb_error_msg("getnetbyaddr (%08x)", (unsigned)host_ad); |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 150 | #endif |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 151 | np = getnetbyaddr(host_ad, AF_INET); |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 152 | if (np) |
| 153 | name = xstrdup(np->n_name); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 154 | } |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 155 | if (!name) |
| 156 | name = xstrdup(inet_ntoa(s_in->sin_addr)); |
| 157 | pn = xmalloc(sizeof(*pn) + strlen(name)); /* no '+ 1', it's already accounted for */ |
| 158 | pn->next = cache; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 159 | pn->addr = *s_in; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 160 | pn->host = host; |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 161 | strcpy(pn->name, name); |
| 162 | cache = pn; |
| 163 | return name; |
Eric Andersen | c223ced | 2001-11-10 12:18:42 +0000 | [diff] [blame] | 164 | } |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 165 | |
Denis Vlasenko | e324184 | 2007-08-13 10:36:25 +0000 | [diff] [blame] | 166 | #if ENABLE_FEATURE_IPV6 |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 167 | |
Denis Vlasenko | defc1ea | 2008-06-27 02:52:20 +0000 | [diff] [blame] | 168 | int FAST_FUNC INET6_resolve(const char *name, struct sockaddr_in6 *sin6) |
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 | struct addrinfo req, *ai; |
| 171 | int s; |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 172 | |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 173 | memset(&req, '\0', sizeof req); |
| 174 | req.ai_family = AF_INET6; |
Denis Vlasenko | 7ca3921 | 2006-11-21 20:34:21 +0000 | [diff] [blame] | 175 | s = getaddrinfo(name, NULL, &req, &ai); |
| 176 | if (s) { |
Manuel Novoa III | cad5364 | 2003-03-19 09:13:01 +0000 | [diff] [blame] | 177 | bb_error_msg("getaddrinfo: %s: %d", name, s); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 178 | return -1; |
| 179 | } |
| 180 | memcpy(sin6, ai->ai_addr, sizeof(struct sockaddr_in6)); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 181 | freeaddrinfo(ai); |
Denis Vlasenko | 7ca3921 | 2006-11-21 20:34:21 +0000 | [diff] [blame] | 182 | return 0; |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 183 | } |
| 184 | |
| 185 | #ifndef IN6_IS_ADDR_UNSPECIFIED |
Glenn L McGrath | d7fb1b3 | 2002-11-26 02:40:56 +0000 | [diff] [blame] | 186 | # define IN6_IS_ADDR_UNSPECIFIED(a) \ |
Bernhard Reutner-Fischer | 38583fd | 2006-05-19 12:44:16 +0000 | [diff] [blame] | 187 | (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \ |
| 188 | ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0) |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 189 | #endif |
| 190 | |
| 191 | |
Denis Vlasenko | defc1ea | 2008-06-27 02:52:20 +0000 | [diff] [blame] | 192 | char* FAST_FUNC INET6_rresolve(struct sockaddr_in6 *sin6, int numeric) |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 193 | { |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 194 | char name[128]; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 195 | int s; |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 196 | |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 197 | if (sin6->sin6_family != AF_INET6) { |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 198 | #ifdef DEBUG |
Denis Vlasenko | 7ca3921 | 2006-11-21 20:34:21 +0000 | [diff] [blame] | 199 | bb_error_msg("rresolve: unsupport address family %d!", |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 200 | sin6->sin6_family); |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 201 | #endif |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 202 | errno = EAFNOSUPPORT; |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 203 | return NULL; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 204 | } |
| 205 | if (numeric & 0x7FFF) { |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 206 | inet_ntop(AF_INET6, &sin6->sin6_addr, name, sizeof(name)); |
| 207 | return xstrdup(name); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 208 | } |
| 209 | if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 210 | if (numeric & 0x8000) |
| 211 | return xstrdup(bb_str_default); |
| 212 | return xstrdup("*"); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 213 | } |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 214 | |
Denis Vlasenko | 703e202 | 2007-01-22 14:12:08 +0000 | [diff] [blame] | 215 | s = getnameinfo((struct sockaddr *) sin6, sizeof(struct sockaddr_in6), |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 216 | name, sizeof(name), NULL, 0, 0); |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 217 | if (s) { |
Manuel Novoa III | cad5364 | 2003-03-19 09:13:01 +0000 | [diff] [blame] | 218 | bb_error_msg("getnameinfo failed"); |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 219 | return NULL; |
Glenn L McGrath | 30db423 | 2002-11-28 09:52:23 +0000 | [diff] [blame] | 220 | } |
Denis Vlasenko | 6d9ea24 | 2007-06-19 11:12:46 +0000 | [diff] [blame] | 221 | return xstrdup(name); |
Eric Andersen | 51b8bd6 | 2002-07-03 11:46:38 +0000 | [diff] [blame] | 222 | } |
| 223 | |
Denis Vlasenko | a5549c9 | 2008-01-24 22:49:15 +0000 | [diff] [blame] | 224 | #endif /* CONFIG_FEATURE_IPV6 */ |