mod_evasiv

I have tried to compile www/mod_evasive. Errors:
Code:
mod_evasive20.c: In function 'access_checker':
mod_evasive20.c:142: error: 'conn_rec' has no member named 'remote_ip'
mod_evasive20.c:146: error: 'conn_rec' has no member named 'remote_ip'
mod_evasive20.c:158: error: 'conn_rec' has no member named 'remote_ip'
.......

Found on the net:
If you move or copy in the work/mod_evasive directory mod_evasive20.c to mod_evasive24.c. Change every appearance of "remote_ip" to "client_ip".

Changed Makefile to:
Code:
USE_APACHE=  24
MODULENAME=  ${PORTNAME}24
post-patch:
  @${REINPLACE_CMD} -e "s|/bin/mail|/usr/bin/mail|g" \
  ${WRKSRC}/mod_evasive.c ${WRKSRC}/mod_evasive24.c \
  ${WRKSRC}/mod_evasiveNSAPI.c

The only thing left is the line in httpd.conf had to be
Code:
LoadModule evasive[B]20[/B]_module  libexec/apache24/mod_evasive24.so
because apache24 says:
Code:
httpd: Syntax error on line 162 of /usr/local/etc/apache24/httpd.conf: Can't locate API module structure `evasive[B]24[/B]_module' in file /usr/local/libexec/apache24/mod_evasive24.so: Undefined symbol "evasive24_module"

(I didn't find the right identifier for evasive(24)_module) but the "thing" compiled and works.
 
Also found after this a patched version of mod_evasive24.c on GitHub: https://github.com/shivaas/mod_evasive/blob/master/mod_evasive24.c

----
Mail is sent to the maintainer.

In the patched file change in line 34 and 531
Code:
module AP_MODULE_DECLARE_DATA evasive20_module;
to
Code:
module AP_MODULE_DECLARE_DATA evasive24_module;
and you can use the "normal" httpd.conf - linc
Code:
LoadModule evasive24_module libexec/apache24/mod_evasive24.so
 
As you see the patched file is different from my idea (and from the author's). But I read in the other thread the question from @alien_sundry.

The same "trick" works for www/mod_bw and www/mod_cband.

mod_bw:
Code:
mod_bw.c:522: error: 'conn_rec' has no member named 'remote_addr'
mod_bw.c: In function 'get_maxconn':
mod_bw.c:611: error: 'conn_rec' has no member named 'remote_addr'
mod_bw.c: In function 'get_sid':
mod_bw.c:662: error: 'conn_rec' has no member named 'remote_addr'
Change remote_addr to client_addr.

mod_cband:
Code:
src/mod_cband.c:1333: error: 'conn_rec' has no member named 'remote_ip'
src/mod_cband.c: In function 'mod_cband_get_remote_host':
src/mod_cband.c:1362: error: 'struct conn_rec' has no member named 'remote_ip'
src/mod_cband.c:1363: error: 'struct conn_rec' has no member named 'remote_ip'
src/mod_cband.c:1365: error: 'struct conn_rec' has no member named 'remote_addr'

Change remote_ip and remote_addr in these lines to client_ip and client_addr, and change the Makefile to
Code:
USE_APACHE=  24

Works means the port compiles, I have not tested it with Apache 2.4! (mod_evasive I have tested with Apache 2.4, and it works).
 
Back
Top