summaryrefslogtreecommitdiff
path: root/src/network.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2016-06-04 13:47:27 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2016-06-04 18:59:03 -0400
commit4eeeb8fc76627316ed62ebd24b3ec6d4b3245f1d (patch)
tree4f7ecb969a4a318fb1ea906b63cb7b3e744f8774 /src/network.c
parentf3e36ccdbb8a974114c0386010c7a4b17e959dcd (diff)
downloadlighttpd1.4-4eeeb8fc76627316ed62ebd24b3ec6d4b3245f1d.tar.gz
lighttpd1.4-4eeeb8fc76627316ed62ebd24b3ec6d4b3245f1d.zip
[config] server.bsd-accept-filter option
BSD accept() filters server.bsd-accept-filter = "" (default) server.bsd-accept-filter = "httpready" server.bsd-accept-filter = "dataready" Note: this is a behavior change from prior versions. The default is now no additional accept() filter, whereas prior versions unconditionally enabled "httpready" accept() filter Additionally, server.defer-accept (Linux) is inherited from global scope into $SERVER["socket"] blocks github: closes #65
Diffstat (limited to 'src/network.c')
-rw-r--r--src/network.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/network.c b/src/network.c
index 19364eaa..f59b8bbe 100644
--- a/src/network.c
+++ b/src/network.c
@@ -448,18 +448,23 @@ static int network_server_init(server *srv, buffer *host_token, specific_config
log_error_write(srv, __FILE__, __LINE__, "ss", "can't set TCP_DEFER_ACCEPT: ", strerror(errno));
}
#endif
- } else {
+#if defined(__FreeBSD__) || defined(__NetBSD__) \
+ || defined(__OpenBSD__) || defined(__DragonflyBSD__)
+ } else if (!buffer_is_empty(s->bsd_accept_filter)
+ && (buffer_is_equal_string(s->bsd_accept_filter, CONST_STR_LEN("httpready"))
+ || buffer_is_equal_string(s->bsd_accept_filter, CONST_STR_LEN("dataready")))) {
#ifdef SO_ACCEPTFILTER
/* FreeBSD accf_http filter */
struct accept_filter_arg afa;
memset(&afa, 0, sizeof(afa));
- strcpy(afa.af_name, "httpready");
+ strncpy(afa.af_name, s->bsd_accept_filter->ptr, sizeof(afa.af_name));
if (setsockopt(srv_socket->fd, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa)) < 0) {
if (errno != ENOENT) {
- log_error_write(srv, __FILE__, __LINE__, "ss", "can't set accept-filter 'httpready': ", strerror(errno));
+ log_error_write(srv, __FILE__, __LINE__, "SBss", "can't set accept-filter '", s->bsd_accept_filter, "':", strerror(errno));
}
}
#endif
+#endif
}
srv_sockets_append: