diff options
Diffstat (limited to 'src/lib/libc')
| -rw-r--r-- | src/lib/libc/net/getaddrinfo.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/libc/net/getaddrinfo.c b/src/lib/libc/net/getaddrinfo.c index da4bc47cb7..e2d1c4186a 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.37 2002/07/01 07:43:48 itojun Exp $ */ | 1 | /* $OpenBSD: getaddrinfo.c,v 1.38 2002/07/01 21:08:13 itojun Exp $ */ |
| 2 | /* $KAME: getaddrinfo.c,v 1.31 2000/08/31 17:36:43 itojun Exp $ */ | 2 | /* $KAME: getaddrinfo.c,v 1.31 2000/08/31 17:36:43 itojun Exp $ */ |
| 3 | 3 | ||
| 4 | /* | 4 | /* |
| @@ -219,7 +219,7 @@ static const struct afd *find_afd(int); | |||
| 219 | static int addrconfig(const struct addrinfo *); | 219 | static int addrconfig(const struct addrinfo *); |
| 220 | #endif | 220 | #endif |
| 221 | #ifdef INET6 | 221 | #ifdef INET6 |
| 222 | static u_int32_t ip6_str2scopeid(char *, struct sockaddr_in6 *); | 222 | static int ip6_str2scopeid(char *, struct sockaddr_in6 *, u_int32_t *); |
| 223 | #endif | 223 | #endif |
| 224 | 224 | ||
| 225 | static void _sethtent(void); | 225 | static void _sethtent(void); |
| @@ -784,7 +784,7 @@ explore_numeric_scope(pai, hostname, servname, res) | |||
| 784 | if (cur->ai_family != AF_INET6) | 784 | if (cur->ai_family != AF_INET6) |
| 785 | continue; | 785 | continue; |
| 786 | sin6 = (struct sockaddr_in6 *)(void *)cur->ai_addr; | 786 | sin6 = (struct sockaddr_in6 *)(void *)cur->ai_addr; |
| 787 | if ((scopeid = ip6_str2scopeid(scope, sin6)) == -1) { | 787 | if (ip6_str2scopeid(scope, sin6, &scopeid) == -1) { |
| 788 | free(hostname2); | 788 | free(hostname2); |
| 789 | return(EAI_NODATA); /* XXX: is return OK? */ | 789 | return(EAI_NODATA); /* XXX: is return OK? */ |
| 790 | } | 790 | } |
| @@ -968,12 +968,12 @@ addrconfig(pai) | |||
| 968 | 968 | ||
| 969 | #ifdef INET6 | 969 | #ifdef INET6 |
| 970 | /* convert a string to a scope identifier. XXX: IPv6 specific */ | 970 | /* convert a string to a scope identifier. XXX: IPv6 specific */ |
| 971 | static u_int32_t | 971 | static int |
| 972 | ip6_str2scopeid(scope, sin6) | 972 | ip6_str2scopeid(scope, sin6, scopeid) |
| 973 | char *scope; | 973 | char *scope; |
| 974 | struct sockaddr_in6 *sin6; | 974 | struct sockaddr_in6 *sin6; |
| 975 | u_int32_t *scopeid; | ||
| 975 | { | 976 | { |
| 976 | u_int32_t scopeid; | ||
| 977 | u_long lscopeid; | 977 | u_long lscopeid; |
| 978 | struct in6_addr *a6 = &sin6->sin6_addr; | 978 | struct in6_addr *a6 = &sin6->sin6_addr; |
| 979 | char *ep; | 979 | char *ep; |
| @@ -988,10 +988,10 @@ ip6_str2scopeid(scope, sin6) | |||
| 988 | * and interfaces, so we simply use interface indices for | 988 | * and interfaces, so we simply use interface indices for |
| 989 | * like-local scopes. | 989 | * like-local scopes. |
| 990 | */ | 990 | */ |
| 991 | scopeid = if_nametoindex(scope); | 991 | *scopeid = if_nametoindex(scope); |
| 992 | if (scopeid == 0) | 992 | if (*scopeid == 0) |
| 993 | goto trynumeric; | 993 | goto trynumeric; |
| 994 | return(scopeid); | 994 | return 0; |
| 995 | } | 995 | } |
| 996 | 996 | ||
| 997 | /* still unclear about literal, allow numeric only - placeholder */ | 997 | /* still unclear about literal, allow numeric only - placeholder */ |
| @@ -1006,9 +1006,9 @@ ip6_str2scopeid(scope, sin6) | |||
| 1006 | trynumeric: | 1006 | trynumeric: |
| 1007 | errno = 0; | 1007 | errno = 0; |
| 1008 | lscopeid = strtoul(scope, &ep, 10); | 1008 | lscopeid = strtoul(scope, &ep, 10); |
| 1009 | scopeid = lscopeid & 0xffffffff; | 1009 | *scopeid = (u_int32_t)(lscopeid & 0xffffffff); |
| 1010 | if (errno == 0 && ep && *ep == '\0' && scopeid == lscopeid) | 1010 | if (errno == 0 && ep && *ep == '\0' && *scopeid == lscopeid) |
| 1011 | return scopeid; | 1011 | return 0; |
| 1012 | else | 1012 | else |
| 1013 | return -1; | 1013 | return -1; |
| 1014 | } | 1014 | } |
