diff options
Diffstat (limited to 'src/lib/libc')
| -rw-r--r-- | src/lib/libc/net/getaddrinfo.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/lib/libc/net/getaddrinfo.c b/src/lib/libc/net/getaddrinfo.c index f33ef91a04..5ab29a97cc 100644 --- a/src/lib/libc/net/getaddrinfo.c +++ b/src/lib/libc/net/getaddrinfo.c | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | /* $OpenBSD: getaddrinfo.c,v 1.21 2000/04/26 16:05:20 itojun Exp $ */ | 1 | /* $OpenBSD: getaddrinfo.c,v 1.22 2000/04/27 05:30:23 itojun Exp $ */ |
| 2 | /* $KAME: getaddrinfo.c,v 1.14 2000/04/26 15:41:49 itojun Exp $ */ | 2 | /* $KAME: getaddrinfo.c,v 1.16 2000/04/27 03:37:43 itojun Exp $ */ |
| 3 | 3 | ||
| 4 | /* | 4 | /* |
| 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
| 6 | * All rights reserved. | 6 | * All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| 10 | * are met: | 10 | * are met: |
| @@ -16,7 +16,7 @@ | |||
| 16 | * 3. Neither the name of the project nor the names of its contributors | 16 | * 3. Neither the name of the project nor the names of its contributors |
| 17 | * may be used to endorse or promote products derived from this software | 17 | * may be used to endorse or promote products derived from this software |
| 18 | * without specific prior written permission. | 18 | * without specific prior written permission. |
| 19 | * | 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND | 20 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND |
| 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| @@ -116,18 +116,11 @@ static const char in_addrany[] = { 0, 0, 0, 0 }; | |||
| 116 | static const char in6_addrany[] = { | 116 | static const char in6_addrany[] = { |
| 117 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 | 117 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
| 118 | }; | 118 | }; |
| 119 | static const char in_loopback[] = { 127, 0, 0, 1 }; | 119 | static const char in_loopback[] = { 127, 0, 0, 1 }; |
| 120 | static const char in6_loopback[] = { | 120 | static const char in6_loopback[] = { |
| 121 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 | 121 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 |
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| 124 | struct sockinet { | ||
| 125 | u_char si_len; | ||
| 126 | u_char si_family; | ||
| 127 | u_short si_port; | ||
| 128 | u_int32_t si_scope_id; | ||
| 129 | }; | ||
| 130 | |||
| 131 | static const struct afd { | 124 | static const struct afd { |
| 132 | int a_af; | 125 | int a_af; |
| 133 | int a_addrlen; | 126 | int a_addrlen; |
| @@ -226,7 +219,7 @@ static int addrconfig __P((const struct addrinfo *)); | |||
| 226 | #endif | 219 | #endif |
| 227 | #ifdef INET6 | 220 | #ifdef INET6 |
| 228 | static int ip6_str2scopeid __P((char *, struct sockaddr_in6 *)); | 221 | static int ip6_str2scopeid __P((char *, struct sockaddr_in6 *)); |
| 229 | #endif | 222 | #endif |
| 230 | 223 | ||
| 231 | static void _sethtent __P((void)); | 224 | static void _sethtent __P((void)); |
| 232 | static void _endhtent __P((void)); | 225 | static void _endhtent __P((void)); |
| @@ -612,6 +605,8 @@ explore_null(pai, servname, res) | |||
| 612 | return 0; | 605 | return 0; |
| 613 | 606 | ||
| 614 | afd = find_afd(pai->ai_family); | 607 | afd = find_afd(pai->ai_family); |
| 608 | if (afd == NULL) | ||
| 609 | return 0; | ||
| 615 | 610 | ||
| 616 | if (pai->ai_flags & AI_PASSIVE) { | 611 | if (pai->ai_flags & AI_PASSIVE) { |
| 617 | GET_AI(cur->ai_next, afd, afd->a_addrany); | 612 | GET_AI(cur->ai_next, afd, afd->a_addrany); |
| @@ -664,6 +659,8 @@ explore_numeric(pai, hostname, servname, res) | |||
| 664 | return 0; | 659 | return 0; |
| 665 | 660 | ||
| 666 | afd = find_afd(pai->ai_family); | 661 | afd = find_afd(pai->ai_family); |
| 662 | if (afd == NULL) | ||
| 663 | return 0; | ||
| 667 | 664 | ||
| 668 | switch (afd->a_af) { | 665 | switch (afd->a_af) { |
| 669 | #if 0 /*X/Open spec*/ | 666 | #if 0 /*X/Open spec*/ |
| @@ -675,7 +672,7 @@ explore_numeric(pai, hostname, servname, res) | |||
| 675 | GET_PORT(cur->ai_next, servname); | 672 | GET_PORT(cur->ai_next, servname); |
| 676 | while (cur && cur->ai_next) | 673 | while (cur && cur->ai_next) |
| 677 | cur = cur->ai_next; | 674 | cur = cur->ai_next; |
| 678 | } else | 675 | } else |
| 679 | ERR(EAI_FAMILY); /*xxx*/ | 676 | ERR(EAI_FAMILY); /*xxx*/ |
| 680 | } | 677 | } |
| 681 | break; | 678 | break; |
| @@ -688,7 +685,7 @@ explore_numeric(pai, hostname, servname, res) | |||
| 688 | GET_PORT(cur->ai_next, servname); | 685 | GET_PORT(cur->ai_next, servname); |
| 689 | while (cur && cur->ai_next) | 686 | while (cur && cur->ai_next) |
| 690 | cur = cur->ai_next; | 687 | cur = cur->ai_next; |
| 691 | } else | 688 | } else |
| 692 | ERR(EAI_FAMILY); /*xxx*/ | 689 | ERR(EAI_FAMILY); /*xxx*/ |
| 693 | } | 690 | } |
| 694 | break; | 691 | break; |
| @@ -730,6 +727,9 @@ explore_numeric_scope(pai, hostname, servname, res) | |||
| 730 | return 0; | 727 | return 0; |
| 731 | 728 | ||
| 732 | afd = find_afd(pai->ai_family); | 729 | afd = find_afd(pai->ai_family); |
| 730 | if (afd == NULL) | ||
| 731 | return 0; | ||
| 732 | |||
| 733 | if (!afd->a_scoped) | 733 | if (!afd->a_scoped) |
| 734 | return explore_numeric(pai, hostname, servname, res); | 734 | return explore_numeric(pai, hostname, servname, res); |
| 735 | 735 | ||
| @@ -976,7 +976,7 @@ ip6_str2scopeid(scope, sin6) | |||
| 976 | else | 976 | else |
| 977 | return -1; | 977 | return -1; |
| 978 | } | 978 | } |
| 979 | #endif | 979 | #endif |
| 980 | 980 | ||
| 981 | /* code duplicate with gethnamaddr.c */ | 981 | /* code duplicate with gethnamaddr.c */ |
| 982 | 982 | ||
