1283. [func] Use "dataready" accept filter if available.

This commit is contained in:
Mark Andrews 2003-08-15 01:16:06 +00:00
parent 67b45f602c
commit b4a3336bb2
5 changed files with 49 additions and 4 deletions

View file

@ -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.

View file

@ -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 <config.h>
@ -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);

View file

@ -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" */

View file

@ -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);
/*

View file

@ -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 <config.h>
@ -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