diff --git a/CHANGES b/CHANGES index 57affeee7d..d49b90eb43 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +1283. [func] Use "dataready" accept filter if available. + 1281. [func] Log zone when unable to get private keys to update zone. Log zone when NXT records are missing from secure zone. diff --git a/bin/named/interfacemgr.c b/bin/named/interfacemgr.c index d4bdaa628e..c859742fab 100644 --- a/bin/named/interfacemgr.c +++ b/bin/named/interfacemgr.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: interfacemgr.c,v 1.59.2.5.8.2 2003/08/08 07:12:25 marka Exp $ */ +/* $Id: interfacemgr.c,v 1.59.2.5.8.3 2003/08/15 01:16:05 marka Exp $ */ #include @@ -312,6 +312,12 @@ ns_interface_accepttcp(ns_interface_t *ifp) { goto tcp_listen_failure; } + /* + * If/when there a multiple filters listen to the + * result. + */ + (void)isc_socket_filter(ifp->tcpsocket, "dataready"); + result = ns_clientmgr_createclients(ifp->clientmgr, ifp->ntcptarget, ifp, ISC_TRUE); diff --git a/lib/isc/include/isc/msgs.h b/lib/isc/include/isc/msgs.h index 43ed4d354f..87033ec5f4 100644 --- a/lib/isc/include/isc/msgs.h +++ b/lib/isc/include/isc/msgs.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: msgs.h,v 1.5.2.2 2002/08/05 06:57:15 marka Exp $ */ +/* $Id: msgs.h,v 1.5.2.2.8.1 2003/08/15 01:16:06 marka Exp $ */ #ifndef ISC_MSGS_H #define ISC_MSGS_H 1 @@ -145,6 +145,7 @@ #define ISC_MSG_ACCEPTRETURNED 1418 /* accept() returned %d/%s */ #define ISC_MSG_TOOMANYFDS 1419 /* %s: too many open file descriptors */ #define ISC_MSG_ZEROPORT 1420 /* dropping source port zero packet */ +#define ISC_MSG_FILTER 1420 /* setsockopt(SO_ACCEPTFILTER): %s */ #define ISC_MSG_AWAKE 1502 /* "awake" */ #define ISC_MSG_WORKING 1503 /* "working" */ diff --git a/lib/isc/include/isc/socket.h b/lib/isc/include/isc/socket.h index ea4099164f..fba12670d5 100644 --- a/lib/isc/include/isc/socket.h +++ b/lib/isc/include/isc/socket.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.h,v 1.54.12.1 2003/08/08 06:50:17 marka Exp $ */ +/* $Id: socket.h,v 1.54.12.2 2003/08/15 01:16:06 marka Exp $ */ #ifndef ISC_SOCKET_H #define ISC_SOCKET_H 1 @@ -326,6 +326,13 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *addressp); * ISC_R_UNEXPECTED */ +isc_result_t +isc_socket_filter(isc_socket_t *sock, const char *filter); +/* + * Inform the kernel that it should perform accept filtering. + * If filter is NULL the current filter will be removed.:w + */ + isc_result_t isc_socket_listen(isc_socket_t *sock, unsigned int backlog); /* diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 06d451ff4d..62d472f55c 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.c,v 1.207.2.19.2.2 2003/08/14 04:31:55 marka Exp $ */ +/* $Id: socket.c,v 1.207.2.19.2.3 2003/08/15 01:16:06 marka Exp $ */ #include @@ -2831,6 +2831,35 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) { return (ISC_R_SUCCESS); } +isc_result_t +isc_socket_filter(isc_socket_t *sock, const char *filter) { +#ifdef SO_ACCEPTFILTER + char strbuf[ISC_STRERRORSIZE]; + struct accept_filter_arg afa; +#else + UNUSED(sock); + UNUSED(filter); +#endif + + REQUIRE(VALID_SOCKET(sock)); + +#ifdef SO_ACCEPTFILTER + bzero(&afa, sizeof(afa)); + strncpy(afa.af_name, filter, sizeof(afa.af_name)); + if (setsockopt(sock->fd, SOL_SOCKET, SO_ACCEPTFILTER, + &afa, sizeof(afa)) == -1) { + isc__strerror(errno, strbuf, sizeof(strbuf)); + socket_log(sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET, + ISC_MSG_FILTER, "setsockopt(SO_ACCEPTFILTER): %s", + strbuf); + return (ISC_R_FAILURE); + } + return (ISC_R_SUCCESS); +#else + return (ISC_R_NOTIMPLEMENTED); +#endif +} + /* * Set up to listen on a given socket. We do this by creating an internal * event that will be dispatched when the socket has read activity. The