From owner-freebsd-apache@freebsd.org Wed Feb 21 07:42:59 2018 Return-Path: Delivered-To: freebsd-apache@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF901F0E77D for ; Wed, 21 Feb 2018 07:42:58 +0000 (UTC) (envelope-from spork@bway.net) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 5F3C46B139 for ; Wed, 21 Feb 2018 07:42:58 +0000 (UTC) (envelope-from spork@bway.net) Received: by mailman.ysv.freebsd.org (Postfix) id 1FD5FF0E778; Wed, 21 Feb 2018 07:42:58 +0000 (UTC) Delivered-To: apache@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1E75F0E775 for ; Wed, 21 Feb 2018 07:42:57 +0000 (UTC) (envelope-from spork@bway.net) Received: from smtp1.bway.net (smtp1.v6.bway.net [IPv6:2607:d300:1::27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B9A36B138 for ; Wed, 21 Feb 2018 07:42:57 +0000 (UTC) (envelope-from spork@bway.net) Received: from frankentosh.sporklab.com (pool-71-187-162-242.nwrknj.fios.verizon.net [71.187.162.242]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: spork@bway.net) by smtp1.bway.net (Postfix) with ESMTPSA id 043319587F for ; Wed, 21 Feb 2018 02:42:50 -0500 (EST) From: Charles Sprickman Content-Type: multipart/mixed; boundary="Apple-Mail=_CFF4E7D2-E07B-4B1A-93C7-0E62C007C2FF" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: FreeBSD Port: www/mod_cband Message-Id: <760D90A5-E9AB-41D4-9E63-E32052DAAAB7@bway.net> Date: Wed, 21 Feb 2018 02:42:50 -0500 To: apache@FreeBSD.org X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-apache@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Support of apache-related ports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 07:42:59 -0000 --Apple-Mail=_CFF4E7D2-E07B-4B1A-93C7-0E62C007C2FF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi, I=E2=80=99m testing out one of the patches floating around to make = mod_cband work on apache 2.4.x, is there any interest in including this = small patch (and one Makefile change) so that mod_cband can be used = with a current apache? After lots of looking, I=E2=80=99m not seeing = anything else that really compares to mod_cband, especially for web = hosting where one needs to enforce a quota on bytes transferred over a = period of time (week, month). Makefile change is just "USE_APACHE=3D 22=E2=80=9D to "USE_APACHE=3D = 22+=E2=80=9D. The other changes are pretty small and are attached - dump them in the = port=E2=80=99s =E2=80=9Cfiles=E2=80=9D directory and it should build. = The compiler warnings are the same as those generated by the current = port (strncmp suggestions, unsigned int comparison warning). I=E2=80=99m running this now on a 10.4 server with apache 2.4.29. I=E2=80= =99d like to let it cook for a few days, but at first glance this seems = to be working fine. Thanks, Charles --=20 Charles Sprickman NetEng/SysAdmin Bway.net - New York's Best Internet www.bway.net spork@bway.net - 212.982.9800 --Apple-Mail=_CFF4E7D2-E07B-4B1A-93C7-0E62C007C2FF Content-Disposition: attachment; filename=patch-mod_cband.c Content-Type: application/octet-stream; x-unix-mode=0644; name="patch-mod_cband.c" Content-Transfer-Encoding: 7bit --- ./src/mod_cband.c.orig 2006-11-14 16:23:36.000000000 -0500 +++ ./src/mod_cband.c 2018-02-21 01:36:57.392077194 -0500 @@ -1330,7 +1330,7 @@ p.bitlen = 32; p.ref_count = 0; p.family = AF_INET; - p.add.sin.s_addr = inet_addr(r->connection->remote_ip); + p.add.sin.s_addr = inet_addr(r->connection->client_ip); node = patricia_search_best(config->tree, &p); @@ -1339,7 +1339,7 @@ if (leaf) { #ifdef DEBUG - fprintf(stderr,"%s leaf %s\n",r->connection->remote_ip,leaf); + fprintf(stderr,"%s leaf %s\n",r->connection->client_ip,leaf); fflush(stderr); #endif return atoi(leaf); @@ -1359,10 +1359,10 @@ if (entry == NULL) return -1; - if (c->remote_ip != NULL) - addr = inet_addr(c->remote_ip); + if (c->client_ip != NULL) + addr = inet_addr(c->client_ip); else - addr = c->remote_addr->sa.sin.sin_addr.s_addr; + addr = c->client_addr->sa.sin.sin_addr.s_addr; time_now = apr_time_now(); hosts = config->remote_hosts.hosts; @@ -1375,7 +1375,7 @@ for (i = 0; i < MAX_REMOTE_HOSTS; i++) { time_delta = (time_now - hosts[i].remote_last_time) / 1e6; if (hosts[i].used && ((time_delta <= MAX_REMOTE_HOST_LIFE) || (hosts[i].remote_conn > 0)) && - (hosts[i].remote_addr == addr) && (hosts[i].virtual_name == entry->virtual_name)) { + (hosts[i].client_addr == addr) && (hosts[i].virtual_name == entry->virtual_name)) { mod_cband_sem_up(config->remote_hosts.sem_id); /* END CRITICAL SECTION */ return i; @@ -1388,7 +1388,7 @@ if ((hosts[i].used == 0) || ((time_delta > MAX_REMOTE_HOST_LIFE) && (hosts[i].remote_conn <= 0))) { memset(&hosts[i], 0, sizeof(mod_cband_remote_host)); hosts[i].used = 1; - hosts[i].remote_addr = addr; + hosts[i].client_addr = addr; hosts[i].remote_last_time = time_now; hosts[i].remote_last_refresh = time_now; hosts[i].virtual_name = entry->virtual_name; @@ -2528,7 +2528,7 @@ unsigned long total_connections = 0; float bps, current_speed_bps = 0; float rps, current_speed_rps = 0; - struct in_addr remote_addr; + struct in_addr client_addr; unsigned long time_now, time_delta; int odd = 0, ok = 0; const char *odd_str; @@ -2804,9 +2804,9 @@ odd = 0; } - remote_addr.s_addr = config->remote_hosts.hosts[i].remote_addr; + client_addr.s_addr = config->remote_hosts.hosts[i].client_addr; ap_rputs("", r); - ap_rprintf(r, "%s", odd_str, inet_ntoa((struct in_addr)remote_addr)); + ap_rprintf(r, "%s", odd_str, inet_ntoa((struct in_addr)client_addr)); ap_rprintf(r, "%s", odd_str, config->remote_hosts.hosts[i].virtual_name); mod_cband_status_print_connections(r, config->remote_hosts.hosts[i].remote_max_conn, config->remote_hosts.hosts[i].remote_conn); --Apple-Mail=_CFF4E7D2-E07B-4B1A-93C7-0E62C007C2FF Content-Disposition: attachment; filename=patch-mod_cband.h Content-Type: application/octet-stream; x-unix-mode=0644; name="patch-mod_cband.h" Content-Transfer-Encoding: 7bit --- src/mod_cband.h.orig 2018-02-21 02:31:56.897849087 -0500 +++ src/mod_cband.h 2018-02-21 01:52:30.289010989 -0500 @@ -159,7 +159,7 @@ typedef struct mod_cband_remote_host { int used; - unsigned long remote_addr; + unsigned long client_addr; unsigned long remote_conn; unsigned long remote_kbps, remote_max_conn; unsigned long remote_last_time; --Apple-Mail=_CFF4E7D2-E07B-4B1A-93C7-0E62C007C2FF Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_CFF4E7D2-E07B-4B1A-93C7-0E62C007C2FF--