Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Lorenzo Martinico
slapos
Commits
d6c20899
Commit
d6c20899
authored
Mar 06, 2012
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update mod_antiloris patch.
parent
00859c2d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
14 deletions
+67
-14
component/apache/buildout.cfg
component/apache/buildout.cfg
+3
-1
component/apache/mod_antiloris-apache-2.4.patch
component/apache/mod_antiloris-apache-2.4.patch
+64
-13
No files found.
component/apache/buildout.cfg
View file @
d6c20899
...
...
@@ -90,12 +90,13 @@ environment =
LDFLAGS =-Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${openssl:location}/lib -L${libuuid:location}/lib -Wl,-rpath=${libuuid:location}/lib -Wl,-rpath=${libexpat:location}/lib -Wl,-rpath=${pcre:location}/lib -Wl,-rpath=${sqlite3:location}/lib -Wl,-rpath=${gdbm:location}/lib
[mod_antiloris-apache-2.4.patch]
# http://www.apachelounge.com/viewtopic.php?p=19139
# http://www.apachelounge.com/viewtopic.php?p=20551
recipe = hexagonit.recipe.download
url =${:_profile_base_location_}/${:filename}
filename = mod_antiloris-apache-2.4.patch
download-only = true
md5sum =
f749e86cdfd8fdc84ef97c3056ffa899
md5sum =
1d4331bf89a7ddf382dbc9589727934b
[apache-antiloris]
# Note: Shall react on each build of apache and reinstall itself
...
...
@@ -108,6 +109,7 @@ patches =
depends =
${apache:version}
${apache:revision}
${mod_antiloris-apache-2.4.patch:md5sum}
configure-command = ${apache:location}/bin/apxs
configure-options = -c mod_antiloris.c
make-binary = ${:configure-command}
...
...
component/apache/mod_antiloris-apache-2.4.patch
View file @
d6c20899
--- mod_antiloris.c.orig 2009-07-28 15:27:42.000000000 +0200
+++ mod_antiloris.c 2012-02-22 11:13:45.132905332 +0100
@@ -22,12 +22,17 @@
+++ mod_antiloris.c 2012-03-06 11:01:10.575566820 +0100
@@ -1,5 +1,5 @@
/*
- mod_antiloris 0.2
+ mod_antiloris 0.5
Copyright (C) 2008 Monshouwer Internet Diensten
Author: Kees Monshouwer
@@ -22,11 +22,16 @@
#include "http_connection.h"
#include "http_log.h"
#include "ap_mpm.h"
...
...
@@ -9,16 +16,43 @@
#include "scoreboard.h"
#define MODULE_NAME "mod_antiloris"
#define MODULE_VERSION "0.4"
-#define MODULE_VERSION "0.4"
+#define MODULE_VERSION "0.5"
+
+#ifdef APLOG_USE_MODULE
+APLOG_USE_MODULE(antiloris);
+#endif
+
module AP_MODULE_DECLARE_DATA antiloris_module;
static int server_limit, thread_limit;
@@ -103,6 +108,7 @@
@@ -58,6 +63,8 @@
/* Parse the IPReadLimit directive */
static const char *ipreadlimit_config_cmd(cmd_parms *parms, void *mconfig, const char *arg)
{
+ signed long int limit;
+
antiloris_config *conf = ap_get_module_config(parms->server->module_config, &antiloris_module);
const char *err = ap_check_cmd_context (parms, GLOBAL_ONLY);
@@ -65,7 +72,7 @@
return err;
}
- signed long int limit = strtol(arg, (char **) NULL, 10);
+ limit = strtol(arg, (char **) NULL, 10);
/* No reasonable person would want more than 2^16. Better would be
to use LONG_MAX but that causes portability problems on win32 */
@@ -80,7 +87,7 @@
/* Array describing structure of configuration directives */
static command_rec antiloris_cmds[] = {
- AP_INIT_TAKE1("IPReadLimit", ipreadlimit_config_cmd, NULL, RSRC_CONF, "Maximum simultaneous connections in READ state per IP address"),
+ AP_INIT_TAKE1("IPReadLimit", ipreadlimit_config_cmd, NULL, RSRC_CONF, "Maximum simultaneous connections per IP address"),
{NULL}
};
@@ -103,12 +110,15 @@
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, MODULE_NAME " " MODULE_VERSION " started");
ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &thread_limit);
ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &server_limit);
...
...
@@ -26,28 +60,45 @@
return OK;
}
@@ -123,14 +129,18 @@
static int pre_connection(conn_rec *c)
{
+ char *client_ip;
+
antiloris_config *conf = ap_get_module_config (c->base_server->module_config, &antiloris_module);
sb_handle *sbh = c->sbh;
@@ -123,16 +133,26 @@
worker_score *ws_record;
ws_record = &ap_scoreboard_image->servers[sbh->child_num][sbh->thread_num];
- apr_cpystrn(ws_record->client, c->remote_ip, sizeof(ws_record->client));
+ apr_cpystrn(ws_record->client, c->client_ip, sizeof(ws_record->client));
char *client_ip = ws_record->client;
- char *client_ip = ws_record->client;
+ client_ip = ws_record->client;
/* Count up the number of connections we are handling right now from this IP address */
for (i = 0; i < server_limit; ++i) {
for (j = 0; j < thread_limit; ++j) {
- ws_record = ap_get_scoreboard_worker(i, j);
+#if AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER > 2
+
ws_record = ap_get_scoreboard_worker_from_indexes(i, j);
+
ws_record = ap_get_scoreboard_worker_from_indexes(i, j);
+#else
+
ws_record = ap_get_scoreboard_worker(i, j);
+
ws_record = ap_get_scoreboard_worker(i, j);
+#endif
switch (ws_record->status) {
case SERVER_BUSY_READ:
+ case SERVER_BUSY_WRITE:
+ case SERVER_BUSY_KEEPALIVE:
+ case SERVER_BUSY_DNS:
+ case SERVER_BUSY_LOG:
+ case SERVER_CLOSING:
+ case SERVER_GRACEFUL:
if (strcmp(client_ip, ws_record->client) == 0)
@@ -143,7 +153,7 @@
ip_count++;
break;
@@ -143,7 +163,7 @@
}
if (ip_count > conf->limit) {
...
...
@@ -56,7 +107,7 @@
return OK;
} else {
return DECLINED;
@@ -151,17 +1
6
1,10 @@
@@ -151,17 +1
7
1,10 @@
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment