--------------------- PatchSet 5349 Date: 2007/08/16 11:34:59 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Move getaddrinfo.h into proper include path - alter dnsserver.cc to use xget*info as a test. Squid3-ipv6 is broken for now by this. Members: configure.in:1.63.2.36->1.63.2.37 include/getaddrinfo.h:1.1->1.1.2.1 lib/getaddrinfo.h:1.1.2.3->1.1.2.4(DEAD) lib/getnameinfo.c:1.1.2.1->1.1.2.2 src/dnsserver.cc:1.7.4.12->1.7.4.13 src/squid.h:1.18.4.8->1.18.4.9 Index: squid3/configure.in =================================================================== RCS file: /cvsroot/squid-sf//squid3/configure.in,v retrieving revision 1.63.2.36 retrieving revision 1.63.2.37 diff -u -r1.63.2.36 -r1.63.2.37 --- squid3/configure.in 16 Aug 2007 10:05:43 -0000 1.63.2.36 +++ squid3/configure.in 16 Aug 2007 11:34:59 -0000 1.63.2.37 @@ -1,7 +1,7 @@ dnl Configuration input file for Squid dnl -dnl $Id: configure.in,v 1.63.2.36 2007/08/16 10:05:43 amosjeffries Exp $ +dnl $Id: configure.in,v 1.63.2.37 2007/08/16 11:34:59 amosjeffries Exp $ dnl dnl dnl @@ -11,7 +11,7 @@ AC_CONFIG_AUX_DIR(cfgaux) AC_CONFIG_SRCDIR([src/main.cc]) AM_INIT_AUTOMAKE([tar-ustar]) -AC_REVISION($Revision: 1.63.2.36 $)dnl +AC_REVISION($Revision: 1.63.2.37 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -1813,21 +1813,22 @@ fi ]) -dnl Enable IPv6 support -AC_MSG_CHECKING([whether to enable IPv6]) - dnl Search for OS support of IP Next Generation functions AC_CHECK_FUNC(getaddrinfo,[ AC_MSG_RESULT([yes]) ],[ AC_LIBOBJ(getaddrinfo) ]) +AC_SUBST(HAVE_GETADDRINFO) AC_CHECK_FUNC(getnameinfo,[ AC_MSG_RESULT([yes]) ],[ AC_LIBOBJ(getnameinfo) ]) +AC_SUBST(HAVE_GETNAMEINFO) dnl Check for Windows XP option +AC_MSG_CHECKING([for IPv6 split-stack requirement]) AC_ARG_WITH(ipv6-split-stack, [ --with-ipv6-split-stack Require IPv6 split-stack support (Requires IPv6 Support)], - AC_DEFINE(USE_IPV6_SPLITSTACK, 1, [Enable support for Split-Stack IPv6 Implementations]) , + AC_DEFINE(USE_IPV6_SPLITSTACK, 1, [Enable support for split-stack IPv6 Implementations]) , AC_DEFINE(USE_IPV6_SPLITSTACK, 0, [No support for split-stack IPv6 Implementations]) ) dnl Check for IPv6 Windows Vista option +AC_MSG_CHECKING([for IPv6 v4-mapping requirement]) AC_ARG_WITH(ipv4-mapped, [ --with-ipv4-mapped Hybrid-Stack OS require Squid to do any v4-mapping (Requires IPv6 Support)], AC_DEFINE(IPV6_SPECIAL_V4MAPPING, 1, [Perform v4-mapping Internally]) , @@ -1845,6 +1846,8 @@ AC_DEFINE(IPV6_SPECIAL_LOCALHOST, 0, [Keep IPv4 and IPv6 Localhosts seperate.]) ) +dnl Enable IPv6 support +AC_MSG_CHECKING([whether to enable IPv6]) AC_ARG_ENABLE(ipv6, [ --enable-ipv6 Enable ipv6 support], [ AC_MSG_RESULT(yes) --- /dev/null Fri Aug 17 00:21:01 2007 +++ squid3/include/getaddrinfo.h Fri Aug 17 00:21:01 2007 @@ -0,0 +1,99 @@ +#ifndef _getaddrinfo_h +#define _getaddrinfo_h + +/* + * Shamelessly duplicated from the fetchmail public sources + * for use by the Squid Project under GNU Public License. + * + * Update/Maintenance History: + * + * 15-Aug-2007 : Copied from fetchmail 6.3.8 + * - added protection around libray headers + * + * 16-Aug-2007 : Altered configure checks + * Un-hacked slightly to use system gethostbyname() + * + * Squid CVS $Id: getaddrinfo.h,v 1.1.2.1 2007/08/16 11:35:06 amosjeffries Exp $ + * + * Original License and code follows. + */ + +#include "config.h" + +/* + * This file is part of libESMTP, a library for submission of RFC 2822 + * formatted electronic mail messages using the SMTP protocol described + * in RFC 2821. + * + * Copyright (C) 2001,2002 Brian Stafford + * + * This 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. + * + * This 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 this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* Structure and prototypes taken from RFC 2553 */ + +#ifdef HAVE_GETADDRINFO + + /* These functions are provided by the OS */ +#define xgetaddrinfo getaddrinfo +#define xfreeaddrinfo freeaddrinfo +#define xgai_strerror gai_strerror + +#else /* !HAVE_GETADDRINFO */ + +struct addrinfo + { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for nodename */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ + }; + +/* Supposed to be defined in */ +#define AI_PASSIVE 1 /* Socket address is intended for `bind'. */ +#define AI_CANONNAME 2 /* Request for canonical name. */ +#define AI_NUMERICHOST 4 /* Don't use name resolution. */ + +/* Supposed to be defined in */ +#define EAI_ADDRFAMILY 1 /* address family for nodename not supported */ +#define EAI_AGAIN 2 /* temporary failure in name resolution */ +#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ +#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ +#define EAI_FAMILY 5 /* ai_family not supported */ +#define EAI_MEMORY 6 /* memory allocation failure */ +#define EAI_NODATA 7 /* no address associated with nodename */ +#define EAI_NONAME 8 /* nodename nor servname provided, or not known */ +#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ +#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ +#define EAI_SYSTEM 11 /* system error returned in errno */ +#define EAI_OVERFLOW 12 /* argument buffer too small */ + +/* RFC 2553 / Posix resolver */ +int xgetaddrinfo (const char *nodename, const char *servname, + const struct addrinfo *hints, struct addrinfo **res); + +/* Free addrinfo structure and associated storage */ +void xfreeaddrinfo (struct addrinfo *ai); + +/* Convert error return from getaddrinfo() to string */ +const char *xgai_strerror (int code); + +#endif /* HAVE_GETADDRINFO */ + +#endif --- squid3/lib/getaddrinfo.h Fri Aug 17 00:21:01 2007 +++ /dev/null Fri Aug 17 00:21:01 2007 @@ -1,99 +0,0 @@ -#ifndef _getaddrinfo_h -#define _getaddrinfo_h - -/* - * Shamelessly duplicated from the fetchmail public sources - * for use by the Squid Project under GNU Public License. - * - * Update/Maintenance History: - * - * 15-Aug-2007 : Copied from fetchmail 6.3.8 - * - added protection around libray headers - * - * 16-Aug-2007 : Altered configure checks - * Un-hacked slightly to use system gethostbyname() - * - * Squid CVS $Id: getaddrinfo.h,v 1.1.2.3 2007/08/16 10:05:44 amosjeffries Exp $ - * - * Original License and code follows. - */ - -#include "config.h" - -/* - * This file is part of libESMTP, a library for submission of RFC 2822 - * formatted electronic mail messages using the SMTP protocol described - * in RFC 2821. - * - * Copyright (C) 2001,2002 Brian Stafford - * - * This 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. - * - * This 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 this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* Structure and prototypes taken from RFC 2553 */ - -#ifdef HAVE_GETADDRINFO - - /* These functions are provided by the OS */ -#define xgetaddrinfo getaddrinfo -#define xfreeaddrinfo freeaddrinfo -#define xgai_strerror gai_strerror - -#else /* !HAVE_GETADDRINFO */ - -struct addrinfo - { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* length of ai_addr */ - char *ai_canonname; /* canonical name for nodename */ - struct sockaddr *ai_addr; /* binary address */ - struct addrinfo *ai_next; /* next structure in linked list */ - }; - -/* Supposed to be defined in */ -#define AI_PASSIVE 1 /* Socket address is intended for `bind'. */ -#define AI_CANONNAME 2 /* Request for canonical name. */ -#define AI_NUMERICHOST 4 /* Don't use name resolution. */ - -/* Supposed to be defined in */ -#define EAI_ADDRFAMILY 1 /* address family for nodename not supported */ -#define EAI_AGAIN 2 /* temporary failure in name resolution */ -#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ -#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ -#define EAI_FAMILY 5 /* ai_family not supported */ -#define EAI_MEMORY 6 /* memory allocation failure */ -#define EAI_NODATA 7 /* no address associated with nodename */ -#define EAI_NONAME 8 /* nodename nor servname provided, or not known */ -#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ -#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ -#define EAI_SYSTEM 11 /* system error returned in errno */ -#define EAI_OVERFLOW 12 /* argument buffer too small */ - -/* RFC 2553 / Posix resolver */ -int xgetaddrinfo (const char *nodename, const char *servname, - const struct addrinfo *hints, struct addrinfo **res); - -/* Free addrinfo structure and associated storage */ -void xfreeaddrinfo (struct addrinfo *ai); - -/* Convert error return from getaddrinfo() to string */ -const char *xgai_strerror (int code); - -#endif /* HAVE_GETADDRINFO */ - -#endif Index: squid3/lib/getnameinfo.c =================================================================== RCS file: /cvsroot/squid-sf//squid3/lib/Attic/getnameinfo.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid3/lib/getnameinfo.c 16 Aug 2007 10:05:44 -0000 1.1.2.1 +++ squid3/lib/getnameinfo.c 16 Aug 2007 11:35:06 -0000 1.1.2.2 @@ -9,7 +9,7 @@ * - added use of alternative name xgetnameinfo * to split from any OS-provided. * - * Squid CVS $Id: getnameinfo.c,v 1.1.2.1 2007/08/16 10:05:44 amosjeffries Exp $ + * Squid CVS $Id: getnameinfo.c,v 1.1.2.2 2007/08/16 11:35:06 amosjeffries Exp $ * * Original License and code follows. */ @@ -70,11 +70,7 @@ * - gethostbyaddr() is usually not thread safe. */ -#ifdef HAVE_GETNAMEINFO - -#define xgetnameinfo getnameinfo - -#else +#ifndef HAVE_GETNAMEINFO #if HAVE_SYS_TYPES_H #include Index: squid3/src/dnsserver.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/dnsserver.cc,v retrieving revision 1.7.4.12 retrieving revision 1.7.4.13 diff -u -r1.7.4.12 -r1.7.4.13 --- squid3/src/dnsserver.cc 9 Aug 2007 05:11:58 -0000 1.7.4.12 +++ squid3/src/dnsserver.cc 16 Aug 2007 11:35:08 -0000 1.7.4.13 @@ -1,6 +1,6 @@ /* - * $Id: dnsserver.cc,v 1.7.4.12 2007/08/09 05:11:58 amosjeffries Exp $ + * $Id: dnsserver.cc,v 1.7.4.13 2007/08/16 11:35:08 amosjeffries Exp $ * * DEBUG: section 0 DNS Resolver * AUTHOR: Harvest Derived @@ -179,7 +179,7 @@ freeaddrinfo(AI); AI = NULL; - if( 0 == (res = getaddrinfo(buf,NULL,&hints,&AI)) ) + if( 0 == (res = xgetaddrinfo(buf,NULL,&hints,&AI)) ) break; if (res != EAI_AGAIN) @@ -238,7 +238,7 @@ */ if(NULL != AI && NULL != AI->ai_addr) { for(;;) { - if( 0 == (res = getnameinfo(AI->ai_addr, AI->ai_addrlen, ntoabuf, MAX_IPSTRLEN, NULL,0,0)) ) + if( 0 == (res = xgetnameinfo(AI->ai_addr, AI->ai_addrlen, ntoabuf, MAX_IPSTRLEN, NULL,0,0)) ) break; if (res != EAI_AGAIN) Index: squid3/src/squid.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/squid.h,v retrieving revision 1.18.4.8 retrieving revision 1.18.4.9 diff -u -r1.18.4.8 -r1.18.4.9 --- squid3/src/squid.h 15 Aug 2007 05:16:38 -0000 1.18.4.8 +++ squid3/src/squid.h 16 Aug 2007 11:35:08 -0000 1.18.4.9 @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.18.4.8 2007/08/15 05:16:38 amosjeffries Exp $ + * $Id: squid.h,v 1.18.4.9 2007/08/16 11:35:08 amosjeffries Exp $ * * AUTHOR: Duane Wessels * @@ -380,14 +380,10 @@ #include "util.h" #include "profiling.h" #include "MemPool.h" -#include "IPAddress.h" -#if !HAVE_GETADDRINFO - /* include the local definition of getaddrinfo */ #include "getaddrinfo.h" - /* and supporting function */ -#include "gethostbyname.h" -#endif +#include "getnameinfo.h" +#include "IPAddress.h" #if !HAVE_TEMPNAM #include "tempnam.h"