From 78fe9730553e19b67c77d3e2f3f4b3df04717be4 Mon Sep 17 00:00:00 2001 From: Jan Kneschke Date: Wed, 4 Jan 2006 23:30:07 +0000 Subject: [PATCH] - added mod_evasive to the autoconf build - ignore connections from the count which are not yet initialized git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@919 152afb58-edef-0310-8abb-c4023f1b3aa9 --- src/Makefile.am | 6 ++++++ src/mod_evasive.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 8caace22..7e9fc9e4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -68,6 +68,12 @@ src += $(common_src) common_libadd = endif +lib_LTLIBRARIES += mod_evasive.la +mod_evasive_la_SOURCES = mod_evasive.c +mod_evasive_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined +mod_evasive_la_LIBADD = $(common_libadd) + + lib_LTLIBRARIES += mod_webdav.la mod_webdav_la_SOURCES = mod_webdav.c mod_webdav_la_CFLAGS = $(XML_CFLAGS) diff --git a/src/mod_evasive.c b/src/mod_evasive.c index 128540ce..b9d19ca3 100644 --- a/src/mod_evasive.c +++ b/src/mod_evasive.c @@ -141,7 +141,11 @@ URIHANDLER_FUNC(mod_evasive_uri_handler) { for (j = 0; j < srv->conns->used; j++) { connection *c = srv->conns->ptr[j]; - if (c->dst_addr.ipv4.sin_addr.s_addr == con->dst_addr.ipv4.sin_addr.s_addr) { + /* check if other connections are already actively serving data for the same IP + * we can only ban connections which are already behind the 'read request' state + * */ + if (c->dst_addr.ipv4.sin_addr.s_addr == con->dst_addr.ipv4.sin_addr.s_addr && + c->state > CON_STATE_REQUEST_END) { conns_by_ip++; if (conns_by_ip > p->conf.max_conns) {