diff options
Diffstat (limited to 'lib/isc')
-rw-r--r-- | lib/isc/Makefile.in | 13 | ||||
-rw-r--r-- | lib/isc/api | 4 | ||||
-rw-r--r-- | lib/isc/entropy.c | 11 | ||||
-rw-r--r-- | lib/isc/include/isc/mem.h | 4 | ||||
-rw-r--r-- | lib/isc/include/isc/platform.h.in | 10 | ||||
-rw-r--r-- | lib/isc/include/isc/task.h | 14 | ||||
-rw-r--r-- | lib/isc/mem.c | 17 | ||||
-rw-r--r-- | lib/isc/nothreads/Makefile.in | 10 | ||||
-rw-r--r-- | lib/isc/print.c | 2 | ||||
-rw-r--r-- | lib/isc/pthreads/mutex.c | 9 | ||||
-rw-r--r-- | lib/isc/task.c | 13 | ||||
-rw-r--r-- | lib/isc/unix/socket.c | 45 |
12 files changed, 114 insertions, 38 deletions
diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index 6fa284b..d831fcf 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 1998-2003 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.96.50.3 2009/02/16 01:02:58 marka Exp $ +# $Id: Makefile.in,v 1.96.50.6 2010-06-09 01:52:54 marka Exp $ srcdir = @srcdir@ VPATH = @srcdir@ @@ -42,8 +42,9 @@ UNIXOBJS = @ISC_ISCIPV6_O@ \ NLSOBJS = nls/msgcat.@O@ -THREADOBJS = @ISC_THREAD_DIR@/condition.@O@ @ISC_THREAD_DIR@/mutex.@O@ \ - @ISC_THREAD_DIR@/thread.@O@ +THREADOPTOBJS = @ISC_THREAD_DIR@/condition.@O@ @ISC_THREAD_DIR@/mutex.@O@ + +THREADOBJS = @THREADOPTOBJS@ @ISC_THREAD_DIR@/thread.@O@ WIN32OBJS = win32/condition.@O@ win32/dir.@O@ win32/file.@O@ \ win32/fsaccess.@O@ win32/once.@O@ win32/stdtime.@O@ \ @@ -80,6 +81,10 @@ SRCS = @ISC_EXTRA_SRCS@ \ LIBS = @LIBS@ +# Note: the order of SUBDIRS is important. +# Attempt to disable parallel processing. +.NOTPARALLEL: +.NO_PARALLEL: SUBDIRS = include unix nls @ISC_THREAD_DIR@ @ISC_ARCH_DIR@ TARGETS = timestamp diff --git a/lib/isc/api b/lib/isc/api index b765f45..e1f7b71 100644 --- a/lib/isc/api +++ b/lib/isc/api @@ -1,3 +1,3 @@ -LIBINTERFACE = 53 +LIBINTERFACE = 54 LIBREVISION = 1 -LIBAGE = 3 +LIBAGE = 4 diff --git a/lib/isc/entropy.c b/lib/isc/entropy.c index 25ab002..af8757f 100644 --- a/lib/isc/entropy.c +++ b/lib/isc/entropy.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009, 2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: entropy.c,v 1.18.332.2 2009/01/18 23:47:41 tbox Exp $ */ +/* $Id: entropy.c,v 1.18.332.4 2010-08-10 23:46:54 tbox Exp $ */ /*! \file * \brief @@ -283,8 +283,11 @@ entropypool_add_word(isc_entropypool_t *rp, isc_uint32_t val) { val ^= rp->pool[(rp->cursor + TAP3) & (RND_POOLWORDS - 1)]; val ^= rp->pool[(rp->cursor + TAP4) & (RND_POOLWORDS - 1)]; val ^= rp->pool[(rp->cursor + TAP5) & (RND_POOLWORDS - 1)]; - rp->pool[rp->cursor++] ^= - ((val << rp->rotate) | (val >> (32 - rp->rotate))); + if (rp->rotate == 0) + rp->pool[rp->cursor++] ^= val; + else + rp->pool[rp->cursor++] ^= + ((val << rp->rotate) | (val >> (32 - rp->rotate))); /* * If we have looped around the pool, increment the rotate diff --git a/lib/isc/include/isc/mem.h b/lib/isc/include/isc/mem.h index b49d440..d13d912 100644 --- a/lib/isc/include/isc/mem.h +++ b/lib/isc/include/isc/mem.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mem.h,v 1.78.120.3.24.2 2010/08/12 23:46:25 tbox Exp $ */ +/* $Id: mem.h,v 1.78.120.6 2010-08-11 23:04:21 jinmei Exp $ */ #ifndef ISC_MEM_H #define ISC_MEM_H 1 @@ -121,7 +121,7 @@ LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_debugging; #if ISC_MEM_TRACKLINES #define _ISC_MEM_FILELINE , __FILE__, __LINE__ -#define _ISC_MEM_FLARG , const char *, int +#define _ISC_MEM_FLARG , const char *, unsigned int #else #define _ISC_MEM_FILELINE #define _ISC_MEM_FLARG diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 1ed76b8..99c887b 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: platform.h.in,v 1.48.84.2 2009/02/16 23:47:15 tbox Exp $ */ +/* $Id: platform.h.in,v 1.48.84.4 2010-06-03 23:47:49 tbox Exp $ */ #ifndef ISC_PLATFORM_H #define ISC_PLATFORM_H 1 @@ -215,6 +215,12 @@ @ISC_PLATFORM_GSSAPIHEADER@ /* + * Defined to <krb5.h> or <krb5/krb5.h> for how to include + * the KRB5 header. + */ +@ISC_PLATFORM_KRB5HEADER@ + +/* * Type used for resource limits. */ @ISC_PLATFORM_RLIMITTYPE@ diff --git a/lib/isc/include/isc/task.h b/lib/isc/include/isc/task.h index 8106571..a8c7569 100644 --- a/lib/isc/include/isc/task.h +++ b/lib/isc/include/isc/task.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009, 2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: task.h,v 1.61.332.2 2009/01/18 23:47:41 tbox Exp $ */ +/* $Id: task.h,v 1.61.332.4 2010-12-03 23:45:47 tbox Exp $ */ #ifndef ISC_TASK_H #define ISC_TASK_H 1 @@ -535,6 +535,16 @@ isc_task_getcurrenttime(isc_task_t *task, isc_stdtime_t *t); *\li '*t' has the "current time". */ +isc_boolean_t +isc_task_exiting(isc_task_t *t); +/*%< + * Returns ISC_TRUE if the task is in the process of shutting down, + * ISC_FALSE otherwise. + * + * Requires: + *\li 'task' is a valid task. + */ + /***** ***** Task Manager. *****/ diff --git a/lib/isc/mem.c b/lib/isc/mem.c index 59f5924..aeacfc0 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mem.c,v 1.145.120.4.24.2 2010/08/12 23:46:25 tbox Exp $ */ +/* $Id: mem.c,v 1.145.120.9 2010-08-11 23:45:49 tbox Exp $ */ /*! \file */ @@ -72,7 +72,7 @@ struct debuglink { }; #define FLARG_PASS , file, line -#define FLARG , const char *file, int line +#define FLARG , const char *file, unsigned int line #else #define FLARG_PASS #define FLARG @@ -221,6 +221,7 @@ add_trace_entry(isc_mem_t *mctx, const void *ptr, unsigned int size { debuglink_t *dl; unsigned int i; + unsigned int mysize = size; if ((isc_mem_debugging & ISC_MEM_DEBUGTRACE) != 0) fprintf(stderr, isc_msgcat_get(isc_msgcat, ISC_MSGSET_MEM, @@ -232,10 +233,10 @@ add_trace_entry(isc_mem_t *mctx, const void *ptr, unsigned int size if (mctx->debuglist == NULL) return; - if (size > mctx->max_size) - size = mctx->max_size; + if (mysize > mctx->max_size) + mysize = mctx->max_size; - dl = ISC_LIST_HEAD(mctx->debuglist[size]); + dl = ISC_LIST_HEAD(mctx->debuglist[mysize]); while (dl != NULL) { if (dl->count == DEBUGLIST_COUNT) goto next; @@ -270,7 +271,7 @@ add_trace_entry(isc_mem_t *mctx, const void *ptr, unsigned int size dl->line[0] = line; dl->count = 1; - ISC_LIST_PREPEND(mctx->debuglist[size], dl, link); + ISC_LIST_PREPEND(mctx->debuglist[mysize], dl, link); mctx->debuglistcnt++; } @@ -877,13 +878,13 @@ destroy(isc_mem_t *ctx) { unsigned int i; isc_ondestroy_t ondest; - ctx->magic = 0; - LOCK(&lock); ISC_LIST_UNLINK(contexts, ctx, link); totallost += ctx->inuse; UNLOCK(&lock); + ctx->magic = 0; + INSIST(ISC_LIST_EMPTY(ctx->pools)); #if ISC_MEM_TRACKLINES diff --git a/lib/isc/nothreads/Makefile.in b/lib/isc/nothreads/Makefile.in index 75a2cb5..042cfce 100644 --- a/lib/isc/nothreads/Makefile.in +++ b/lib/isc/nothreads/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2010 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2000, 2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.7 2007/06/19 23:47:18 tbox Exp $ +# $Id: Makefile.in,v 1.7.332.2 2010-06-09 23:48:16 tbox Exp $ srcdir = @srcdir@ VPATH = @srcdir@ @@ -28,9 +28,11 @@ CINCLUDES = -I${srcdir}/include \ CDEFINES = CWARNINGS = -OBJS = condition.@O@ mutex.@O@ thread.@O@ +THREADOPTOBJS = condition.@O@ mutex.@O@ +OBJS = @THREADOPTOBJS@ thread.@O@ -SRCS = condition.c mutex.c thread.c +THREADOPTSRCS = condition.c mutex.c +SRCS = @THREADOPTSRCS@ thread.c SUBDIRS = include TARGETS = ${OBJS} diff --git a/lib/isc/print.c b/lib/isc/print.c index 6b98195..5d800f3 100644 --- a/lib/isc/print.c +++ b/lib/isc/print.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: print.c,v 1.35.418.2 2010/10/18 23:46:34 tbox Exp $ */ +/* $Id: print.c,v 1.35.130.2 2010-10-18 23:46:17 tbox Exp $ */ /*! \file */ diff --git a/lib/isc/pthreads/mutex.c b/lib/isc/pthreads/mutex.c index b57d9ee..efe38db 100644 --- a/lib/isc/pthreads/mutex.c +++ b/lib/isc/pthreads/mutex.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2008, 2011 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mutex.c,v 1.16 2008/04/04 23:47:01 tbox Exp $ */ +/* $Id: mutex.c,v 1.16.112.2 2011-01-04 23:45:43 tbox Exp $ */ /*! \file */ @@ -234,10 +234,13 @@ isc_mutex_init_errcheck(isc_mutex_t *mp) if (pthread_mutexattr_init(&attr) != 0) return (ISC_R_UNEXPECTED); - if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK) != 0) + if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK) != 0) { + pthread_mutexattr_destroy(&attr); return (ISC_R_UNEXPECTED); + } err = pthread_mutex_init(mp, &attr) != 0) + pthread_mutexattr_destroy(&attr); if (err == ENOMEM) return (ISC_R_NOMEMORY); return ((err == 0) ? ISC_R_SUCCESS : ISC_R_UNEXPECTED); diff --git a/lib/isc/task.c b/lib/isc/task.c index a630173..5d87f21 100644 --- a/lib/isc/task.c +++ b/lib/isc/task.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008, 2010 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: task.c,v 1.107 2008/03/27 23:46:57 tbox Exp $ */ +/* $Id: task.c,v 1.107.120.2 2010-12-03 23:45:47 tbox Exp $ */ /*! \file * \author Principal Author: Bob Halley @@ -1292,8 +1292,15 @@ isc_task_endexclusive(isc_task_t *task) { #endif } -#ifdef HAVE_LIBXML2 +isc_boolean_t +isc_task_exiting(isc_task_t *t) { + isc_task_t *task = (isc_task_t *)t; + + REQUIRE(VALID_TASK(task)); + return (TASK_SHUTTINGDOWN(task)); +} +#ifdef HAVE_LIBXML2 void isc_taskmgr_renderxml(isc_taskmgr_t *mgr, xmlTextWriterPtr writer) { diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 004a038..055e883 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.c,v 1.308.12.12 2010/01/31 23:47:31 tbox Exp $ */ +/* $Id: socket.c,v 1.308.12.17 2010-12-22 03:28:13 marka Exp $ */ /*! \file */ @@ -67,7 +67,11 @@ #include <sys/epoll.h> #endif #ifdef ISC_PLATFORM_HAVEDEVPOLL +#if defined(HAVE_SYS_DEVPOLL_H) #include <sys/devpoll.h> +#elif defined(HAVE_DEVPOLL_H) +#include <devpoll.h> +#endif #endif #include "errno2result.h" @@ -652,6 +656,7 @@ watch_fd(isc_socketmgr_t *manager, int fd, int msg) { event.events = EPOLLIN; else event.events = EPOLLOUT; + memset(&event.data, 0, sizeof(event.data)); event.data.fd = fd; if (epoll_ctl(manager->epoll_fd, EPOLL_CTL_ADD, fd, &event) == -1 && errno != EEXIST) { @@ -719,6 +724,7 @@ unwatch_fd(isc_socketmgr_t *manager, int fd, int msg) { event.events = EPOLLIN; else event.events = EPOLLOUT; + memset(&event.data, 0, sizeof(event.data)); event.data.fd = fd; if (epoll_ctl(manager->epoll_fd, EPOLL_CTL_DEL, fd, &event) == -1 && errno != ENOENT) { @@ -2232,6 +2238,26 @@ opensocket(isc_socketmgr_t *manager, isc_socket_t *sock) { (void *)&on, sizeof(on)); } #endif +#if defined(IPV6_MTU) + /* + * Use minimum MTU on IPv6 sockets. + */ + if (sock->pf == AF_INET6) { + int mtu = 1280; + (void)setsockopt(sock->fd, IPPROTO_IPV6, IPV6_MTU, + &mtu, sizeof(mtu)); + } +#endif +#if defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DONT) + /* + * Turn off Path MTU discovery on IPv6/UDP sockets. + */ + if (sock->pf == AF_INET6) { + int action = IPV6_PMTUDISC_DONT; + (void)setsockopt(sock->fd, IPPROTO_IPV6, IPV6_MTU_DISCOVER, + &action, sizeof(action)); + } +#endif #endif /* ISC_PLATFORM_HAVEIPV6 */ #endif /* defined(USE_CMSG) */ @@ -4712,9 +4738,16 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr, return (ISC_R_SUCCESS); } +/* + * Enable this only for specific OS versions, and only when they have repaired + * their problems with it. Until then, this is is broken and needs to be + * diabled by default. See RT22589 for details. + */ +#undef ENABLE_ACCEPTFILTER + isc_result_t isc_socket_filter(isc_socket_t *sock, const char *filter) { -#ifdef SO_ACCEPTFILTER +#if defined(SO_ACCEPTFILTER) && defined(ENABLE_ACCEPTFILTER) char strbuf[ISC_STRERRORSIZE]; struct accept_filter_arg afa; #else @@ -4724,7 +4757,7 @@ isc_socket_filter(isc_socket_t *sock, const char *filter) { REQUIRE(VALID_SOCKET(sock)); -#ifdef SO_ACCEPTFILTER +#if defined(SO_ACCEPTFILTER) && defined(ENABLE_ACCEPTFILTER) bzero(&afa, sizeof(afa)); strncpy(afa.af_name, filter, sizeof(afa.af_name)); if (setsockopt(sock->fd, SOL_SOCKET, SO_ACCEPTFILTER, @@ -4829,6 +4862,12 @@ isc_socket_accept(isc_socket_t *sock, * Attach to socket and to task. */ isc_task_attach(task, &ntask); + if (isc_task_exiting(ntask)) { + isc_task_detach(&ntask); + isc_event_free(ISC_EVENT_PTR(&dev)); + UNLOCK(&sock->lock); + return (ISC_R_SHUTTINGDOWN); + } nsock->references++; nsock->statsindex = sock->statsindex; |