summaryrefslogtreecommitdiffstats
path: root/contrib/bind9/lib/isc/unix
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2011-09-03 07:13:45 +0000
committerdougb <dougb@FreeBSD.org>2011-09-03 07:13:45 +0000
commitf18a6196d77d71d90e7f726cfc30101abb2958e1 (patch)
treedf1f07c78f187c54ea276c24753c42174127668e /contrib/bind9/lib/isc/unix
parentfbc49b949e99a3bf0c24ca3f9e542ae398b89dca (diff)
parent9c893fc637e8791d7faedec39c0993533a1fbb6e (diff)
downloadFreeBSD-src-f18a6196d77d71d90e7f726cfc30101abb2958e1.zip
FreeBSD-src-f18a6196d77d71d90e7f726cfc30101abb2958e1.tar.gz
Upgrade to BIND version 9.8.1. Release notes at:
https://deepthought.isc.org/article/AA-00446/81/ or /usr/src/contrib/bind9/ Approved by: re (kib)
Diffstat (limited to 'contrib/bind9/lib/isc/unix')
-rw-r--r--contrib/bind9/lib/isc/unix/dir.c6
-rw-r--r--contrib/bind9/lib/isc/unix/file.c19
-rw-r--r--contrib/bind9/lib/isc/unix/include/isc/stdtime.h8
-rw-r--r--contrib/bind9/lib/isc/unix/socket.c74
-rw-r--r--contrib/bind9/lib/isc/unix/stdio.c5
-rw-r--r--contrib/bind9/lib/isc/unix/time.c6
6 files changed, 87 insertions, 31 deletions
diff --git a/contrib/bind9/lib/isc/unix/dir.c b/contrib/bind9/lib/isc/unix/dir.c
index 0caf882..e670f03 100644
--- a/contrib/bind9/lib/isc/unix/dir.c
+++ b/contrib/bind9/lib/isc/unix/dir.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2005, 2007-2009 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004, 2005, 2007-2009, 2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2001 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dir.c,v 1.29 2009-02-16 23:48:04 tbox Exp $ */
+/* $Id: dir.c,v 1.29.404.2 2011-03-12 04:59:19 tbox Exp $ */
/*! \file
* \author Principal Authors: DCL */
@@ -79,7 +79,7 @@ isc_dir_open(isc_dir_t *dir, const char *dirname) {
if (dir->dirname < p && *(p - 1) != '/')
*p++ = '/';
*p++ = '*';
- *p++ = '\0';
+ *p = '\0';
/*
* Open stream.
diff --git a/contrib/bind9/lib/isc/unix/file.c b/contrib/bind9/lib/isc/unix/file.c
index 25d856c..3e4d3e0 100644
--- a/contrib/bind9/lib/isc/unix/file.c
+++ b/contrib/bind9/lib/isc/unix/file.c
@@ -48,7 +48,7 @@
* SUCH DAMAGE.
*/
-/* $Id: file.c,v 1.57 2011-01-11 23:47:14 tbox Exp $ */
+/* $Id: file.c,v 1.57.10.1 2011-03-04 14:10:13 smann Exp $ */
/*! \file */
@@ -348,6 +348,23 @@ isc_file_exists(const char *pathname) {
return (ISC_TF(file_stats(pathname, &stats) == ISC_R_SUCCESS));
}
+isc_result_t
+isc_file_isplainfile(const char *filename) {
+ /*
+ * This function returns success if filename is a plain file.
+ */
+ struct stat filestat;
+ memset(&filestat,0,sizeof(struct stat));
+
+ if ((stat(filename, &filestat)) == -1)
+ return(isc__errno2result(errno));
+
+ if(! S_ISREG(filestat.st_mode))
+ return(ISC_R_INVALIDFILE);
+
+ return(ISC_R_SUCCESS);
+}
+
isc_boolean_t
isc_file_isabsolute(const char *filename) {
REQUIRE(filename != NULL);
diff --git a/contrib/bind9/lib/isc/unix/include/isc/stdtime.h b/contrib/bind9/lib/isc/unix/include/isc/stdtime.h
index 581e6f7..cadb382 100644
--- a/contrib/bind9/lib/isc/unix/include/isc/stdtime.h
+++ b/contrib/bind9/lib/isc/unix/include/isc/stdtime.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004, 2005, 2007, 2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2001 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: stdtime.h,v 1.14 2007-06-19 23:47:19 tbox Exp $ */
+/* $Id: stdtime.h,v 1.14.814.2 2011-03-18 23:47:15 tbox Exp $ */
#ifndef ISC_STDTIME_H
#define ISC_STDTIME_H 1
@@ -31,6 +31,10 @@
* about its size.
*/
typedef isc_uint32_t isc_stdtime_t;
+
+/* but this flag helps... */
+#define STDTIME_ON_32BITS 1
+
/*
* isc_stdtime32_t is a 32-bit version of isc_stdtime_t. A variable of this
* type should only be used as an opaque integer (e.g.,) to compare two
diff --git a/contrib/bind9/lib/isc/unix/socket.c b/contrib/bind9/lib/isc/unix/socket.c
index ec7487e..c9aa454 100644
--- a/contrib/bind9/lib/isc/unix/socket.c
+++ b/contrib/bind9/lib/isc/unix/socket.c
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: socket.c,v 1.333.14.2.2.1 2011-06-02 23:47:36 tbox Exp $ */
+/* $Id: socket.c,v 1.333.14.9 2011-07-29 02:19:20 marka Exp $ */
/*! \file */
@@ -764,6 +764,7 @@ FIX_IPV6_RECVPKTINFO(isc__socket_t *sock)
if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_RECVPKTINFO,
(void *)&on, sizeof(on)) < 0) {
+ isc__strerror(errno, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__,
"setsockopt(%d, IPV6_RECVPKTINFO) "
"%s: %s", sock->fd,
@@ -1364,6 +1365,9 @@ build_msghdr_send(isc__socket_t *sock, isc_socketevent_t *dev,
#if defined(USE_CMSG) && defined(ISC_PLATFORM_HAVEIN6PKTINFO)
if ((sock->type == isc_sockettype_udp)
&& ((dev->attributes & ISC_SOCKEVENTATTR_PKTINFO) != 0)) {
+#if defined(IPV6_USE_MIN_MTU)
+ int use_min_mtu = 1; /* -1, 0, 1 */
+#endif
struct cmsghdr *cmsgp;
struct in6_pktinfo *pktinfop;
@@ -1382,6 +1386,22 @@ build_msghdr_send(isc__socket_t *sock, isc_socketevent_t *dev,
cmsgp->cmsg_len = cmsg_len(sizeof(struct in6_pktinfo));
pktinfop = (struct in6_pktinfo *)CMSG_DATA(cmsgp);
memcpy(pktinfop, &dev->pktinfo, sizeof(struct in6_pktinfo));
+#if defined(IPV6_USE_MIN_MTU)
+ /*
+ * Set IPV6_USE_MIN_MTU as a per packet option as FreeBSD
+ * ignores setsockopt(IPV6_USE_MIN_MTU) when IPV6_PKTINFO
+ * is used.
+ */
+ cmsgp = (struct cmsghdr *)(sock->sendcmsgbuf +
+ msg->msg_controllen);
+ msg->msg_controllen += cmsg_space(sizeof(use_min_mtu));
+ INSIST(msg->msg_controllen <= sock->sendcmsgbuflen);
+
+ cmsgp->cmsg_level = IPPROTO_IPV6;
+ cmsgp->cmsg_type = IPV6_USE_MIN_MTU;
+ cmsgp->cmsg_len = cmsg_len(sizeof(use_min_mtu));
+ memcpy(CMSG_DATA(cmsgp), &use_min_mtu, sizeof(use_min_mtu));
+#endif
}
#endif /* USE_CMSG && ISC_PLATFORM_HAVEIPV6 */
#else /* ISC_NET_BSD44MSGHDR */
@@ -1758,6 +1778,7 @@ doio_recv(isc__socket_t *sock, isc_socketevent_t *dev) {
} else {
isc_buffer_add(buffer, actual_count);
actual_count = 0;
+ POST(actual_count);
break;
}
buffer = ISC_LIST_NEXT(buffer, link);
@@ -1997,9 +2018,10 @@ destroy(isc__socket_t **sockp) {
SIGNAL(&manager->shutdown_ok);
#endif /* USE_WATCHER_THREAD */
- UNLOCK(&manager->lock);
-
+ /* can't unlock manager as its memory context is still used */
free_socket(sockp);
+
+ UNLOCK(&manager->lock);
}
static isc_result_t
@@ -2036,7 +2058,7 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type,
*/
cmsgbuflen = 0;
#if defined(USE_CMSG) && defined(ISC_PLATFORM_HAVEIN6PKTINFO)
- cmsgbuflen = cmsg_space(sizeof(struct in6_pktinfo));
+ cmsgbuflen += cmsg_space(sizeof(struct in6_pktinfo));
#endif
#if defined(USE_CMSG) && defined(SO_TIMESTAMP)
cmsgbuflen += cmsg_space(sizeof(struct timeval));
@@ -2050,7 +2072,14 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type,
cmsgbuflen = 0;
#if defined(USE_CMSG) && defined(ISC_PLATFORM_HAVEIN6PKTINFO)
- cmsgbuflen = cmsg_space(sizeof(struct in6_pktinfo));
+ cmsgbuflen += cmsg_space(sizeof(struct in6_pktinfo));
+#if defined(IPV6_USE_MIN_MTU)
+ /*
+ * Provide space for working around FreeBSD's broken IPV6_USE_MIN_MTU
+ * support.
+ */
+ cmsgbuflen += cmsg_space(sizeof(int));
+#endif
#endif
sock->sendcmsgbuflen = cmsgbuflen;
if (sock->sendcmsgbuflen != 0U) {
@@ -2400,10 +2429,18 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock) {
#endif /* ISC_PLATFORM_HAVEIN6PKTINFO */
#ifdef IPV6_USE_MIN_MTU /* RFC 3542, not too common yet*/
/* use minimum MTU */
- if (sock->pf == AF_INET6) {
- (void)setsockopt(sock->fd, IPPROTO_IPV6,
- IPV6_USE_MIN_MTU,
- (void *)&on, sizeof(on));
+ if (sock->pf == AF_INET6 &&
+ setsockopt(sock->fd, IPPROTO_IPV6, IPV6_USE_MIN_MTU,
+ (void *)&on, sizeof(on)) < 0) {
+ isc__strerror(errno, strbuf, sizeof(strbuf));
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
+ "setsockopt(%d, IPV6_USE_MIN_MTU) "
+ "%s: %s", sock->fd,
+ isc_msgcat_get(isc_msgcat,
+ ISC_MSGSET_GENERAL,
+ ISC_MSG_FAILED,
+ "failed"),
+ strbuf);
}
#endif
#if defined(IPV6_MTU)
@@ -2422,8 +2459,9 @@ opensocket(isc__socketmgr_t *manager, isc__socket_t *sock) {
*/
if (sock->pf == AF_INET6) {
int action = IPV6_PMTUDISC_DONT;
- (void)setsockopt(sock->fd, IPPROTO_IPV6, IPV6_MTU_DISCOVER,
- &action, sizeof(action));
+ (void)setsockopt(sock->fd, IPPROTO_IPV6,
+ IPV6_MTU_DISCOVER, &action,
+ sizeof(action));
}
#endif
#endif /* ISC_PLATFORM_HAVEIPV6 */
@@ -2755,7 +2793,6 @@ isc__socket_close(isc_socket_t *sock0) {
isc__socket_t *sock = (isc__socket_t *)sock0;
int fd;
isc__socketmgr_t *manager;
- isc_sockettype_t type;
REQUIRE(VALID_SOCKET(sock));
@@ -2775,7 +2812,6 @@ isc__socket_close(isc_socket_t *sock0) {
INSIST(sock->connect_ev == NULL);
manager = sock->manager;
- type = sock->type;
fd = sock->fd;
sock->fd = -1;
memset(sock->name, 0, sizeof(sock->name));
@@ -4455,9 +4491,8 @@ isc__socket_recvv(isc_socket_t *sock0, isc_bufferlist_t *buflist,
INSIST(sock->bound);
dev = allocate_socketevent(sock, ISC_SOCKEVENT_RECVDONE, action, arg);
- if (dev == NULL) {
+ if (dev == NULL)
return (ISC_R_NOMEMORY);
- }
/*
* UDP sockets are always partial read
@@ -4661,9 +4696,8 @@ isc__socket_sendto(isc_socket_t *sock0, isc_region_t *region,
INSIST(sock->bound);
dev = allocate_socketevent(sock, ISC_SOCKEVENT_SENDDONE, action, arg);
- if (dev == NULL) {
+ if (dev == NULL)
return (ISC_R_NOMEMORY);
- }
dev->region = *region;
@@ -4702,9 +4736,8 @@ isc__socket_sendtov(isc_socket_t *sock0, isc_bufferlist_t *buflist,
REQUIRE(iocount > 0);
dev = allocate_socketevent(sock, ISC_SOCKEVENT_SENDDONE, action, arg);
- if (dev == NULL) {
+ if (dev == NULL)
return (ISC_R_NOMEMORY);
- }
/*
* Move each buffer from the passed in list to our internal one.
@@ -5121,6 +5154,7 @@ isc__socket_accept(isc_socket_t *sock0,
*/
isc_task_attach(task, &ntask);
if (isc_task_exiting(ntask)) {
+ free_socket(&nsock);
isc_task_detach(&ntask);
isc_event_free(ISC_EVENT_PTR(&dev));
UNLOCK(&sock->lock);
@@ -5632,7 +5666,7 @@ isc__socket_ipv6only(isc_socket_t *sock0, isc_boolean_t yes) {
if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_V6ONLY,
(void *)&onoff, sizeof(int)) < 0) {
char strbuf[ISC_STRERRORSIZE];
-
+ isc__strerror(errno, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__,
"setsockopt(%d, IPV6_V6ONLY) "
"%s: %s", sock->fd,
diff --git a/contrib/bind9/lib/isc/unix/stdio.c b/contrib/bind9/lib/isc/unix/stdio.c
index ff3a527..9221d2a 100644
--- a/contrib/bind9/lib/isc/unix/stdio.c
+++ b/contrib/bind9/lib/isc/unix/stdio.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004, 2007, 2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: stdio.c,v 1.8 2007-06-19 23:47:18 tbox Exp $ */
+/* $Id: stdio.c,v 1.8.814.2 2011-03-05 23:52:09 tbox Exp $ */
#include <config.h>
@@ -23,6 +23,7 @@
#include <unistd.h>
#include <isc/stdio.h>
+#include <isc/stat.h>
#include "errno2result.h"
diff --git a/contrib/bind9/lib/isc/unix/time.c b/contrib/bind9/lib/isc/unix/time.c
index 1dc05b8..8d1d9fa 100644
--- a/contrib/bind9/lib/isc/unix/time.c
+++ b/contrib/bind9/lib/isc/unix/time.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2008, 2011 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: time.c,v 1.56 2008-02-15 23:46:51 tbox Exp $ */
+/* $Id: time.c,v 1.56.608.2 2011-03-12 04:59:19 tbox Exp $ */
/*! \file */
@@ -319,7 +319,7 @@ isc_time_microdiff(const isc_time_t *t1, const isc_time_t *t2) {
/*
* Convert to microseconds.
*/
- i3 = (i1 - i2) / NS_PER_US;
+ i3 /= NS_PER_US;
return (i3);
}
OpenPOWER on IntegriCloud