# mod_evasiv



## talsamon (Nov 4, 2014)

I have tried to compile www/mod_evasive. Errors:

```
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:

```
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

```
LoadModule evasive[B]20[/B]_module  libexec/apache24/mod_evasive24.so
```
_be_cause apache24 says:

```
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.


----------



## SirDice (Nov 4, 2014)

Contact the maintainer so he can update the port.


----------



## talsamon (Nov 4, 2014)

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  
	
	



```
module AP_MODULE_DECLARE_DATA evasive20_module;
```
to  
	
	



```
module AP_MODULE_DECLARE_DATA evasive24_module;
```
and you can use the "normal" httpd.conf - linc

```
LoadModule evasive24_module libexec/apache24/mod_evasive24.so
```


----------



## talsamon (Nov 4, 2014)

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:

```
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:

```
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 
	
	



```
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).


----------

