OSDN Git Service

Cleanup use of in6addr_loopback and in6addr_any
authorEric Andersen <andersen@codepoet.org>
Thu, 21 Nov 2002 07:03:25 +0000 (07:03 -0000)
committerEric Andersen <andersen@codepoet.org>
Thu, 21 Nov 2002 07:03:25 +0000 (07:03 -0000)
libc/inet/Makefile
libc/inet/getaddrinfo.c
libc/inet/in6_addr.c [new file with mode: 0644]
libc/inet/resolv.c

index efc8cb6..8084851 100644 (file)
@@ -50,7 +50,8 @@ MOBJ3= accept.o bind.o connect.o getpeername.o getsockname.o getsockopt.o \
        setsockopt.o shutdown.o socket.o socketpair.o 
 
 CSRC =getservice.c getproto.c hostid.c getnetent.c getnetbynm.c getnetbyad.c \
-       inet_net.c ntop.c herror.c if_nametoindex.c gai_strerror.c getaddrinfo.c 
+      inet_net.c ntop.c herror.c if_nametoindex.c gai_strerror.c getaddrinfo.c \
+      in6_addr.c
 
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 
index 70bdfbb..a2f595a 100644 (file)
@@ -585,7 +585,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
        {
            at->family = AF_INET6;
            if ((req->ai_flags & AI_PASSIVE) == 0)
-               memcpy (at->addr, &in6addr_loopback, sizeof (struct in6_addr));
+               memcpy (at->addr, &__in6addr_loopback, sizeof (struct in6_addr));
            atr = at->next;
        }
 #endif
diff --git a/libc/inet/in6_addr.c b/libc/inet/in6_addr.c
new file mode 100644 (file)
index 0000000..de90555
--- /dev/null
@@ -0,0 +1,33 @@
+/* Copyright (C) 1997, 1998, 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __FORCE_GLIBC
+#include <features.h>
+#include <netinet/in.h>
+
+#ifdef __UCLIBC_HAS_IPV6__
+const struct in6_addr __in6addr_any =
+{ { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } };
+weak_alias (__in6addr_any, in6addr_any)
+const struct in6_addr __in6addr_loopback =
+{ { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } };
+weak_alias(__in6addr_loopback, in6addr_loopback);
+#endif /* __UCLIBC_HAS_IPV6__ */
+
+
index e6ac9d9..0cc3443 100644 (file)
@@ -933,14 +933,6 @@ struct hostent *gethostbyname(const char *name)
 
 #ifdef L_gethostbyname2
 
-#ifdef __UCLIBC_HAS_IPV6__
-/* TBD: Not the right place for defining these, I guess */
-const struct in6_addr in6addr_any =
-       { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } };
-const struct in6_addr in6addr_loopback =
-       { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } };                                    
-#endif /* __UCLIBC_HAS_IPV6__ */
-
 struct hostent *gethostbyname2(const char *name, int family)
 {
 #ifndef __UCLIBC_HAS_IPV6__
@@ -1686,16 +1678,6 @@ int gethostbyname_r(const char * name,
 
 #ifdef L_gethostbyname2_r
 
-#ifdef __UCLIBC_HAS_IPV6__
-/* TBD: Not the right place for defining these, I guess */
-/*
-const struct in6_addr in6addr_any =
-       { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } };
-const struct in6_addr in6addr_loopback =
-       { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } };
-*/
-#endif /* __UCLIBC_HAS_IPV6__ */
-
 int gethostbyname2_r(const char *name, int family,
                            struct hostent * result_buf,
                            char * buf, size_t buflen,