mod_evasive icon indicating copy to clipboard operation
mod_evasive copied to clipboard

Build error on FreeBSD 13.5

Open devnull-hub-lab opened this issue 1 month ago • 0 comments

Hi,

When building mod_evasive 2.4.0 on FreeBSD 13.5, an error occur. And probably occurs on other UNIXes too (like OpenBSD/Solaris/HPUx/AIX). This happen because on FreeBSD 13.5, the s6_addr32 structure inside /usr/include/netinet6/in6.h is not exposed to userland. In some UNIX, this structure doesn't even exist, or is even considered obsolete.

Also, note that s6_addr32 is non standard. s6_addr is the only in6_addr element specified in RFC 2553 and 3493 – also POSIX 1003.1-2017.

So its safe and better to use s6_addr.

I made a PR changing this: #57 I tested it, and its working. And as it is POSIX standard, it will work on FreeBSD and other UNIXes and unix-like operating systems.

Below, the error on Build, just for your knowledge.

Thanks!

mod_evasive24.c:270:15: error: no member named 's6_addr32' in 'struct in6_addr'
  270 |         addr->s6_addr32[i] &= mask->s6_addr32[i];
      |         ~~~~  ^
mod_evasive24.c:270:37: error: no member named 's6_addr32' in 'struct in6_addr'
  270 |         addr->s6_addr32[i] &= mask->s6_addr32[i];
      |                               ~~~~  ^
mod_evasive24.c:545:44: warning: format specifies type 'long' but the argument has type 'pid_t' (aka 'int') [-Wformat]
  545 |                     fprintf(file, "%ld\n", getpid());
      |                                    ~~~     ^~~~~~~~
      |                                    %d
1 warning and 2 errors generated.
apxs:Error: Command failed with rc=65536
.
*** Error code 1

Stop.

devnull-hub-lab avatar Oct 30 '25 13:10 devnull-hub-lab