This repository was archived by the owner on Nov 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 606
This repository was archived by the owner on Nov 8, 2023. It is now read-only.
Pull request to fix incomplete type 'struct in6_addr' when compiling naxsi 1.1 on FreeBSD #526
Copy link
Copy link
Closed
Description
Hello,
Trying to make a pull request, I got a "ERROR: Permission to nbs-system/naxsi.git denied", so I open an issue.
When compiling naxsi 1.1 as a nginx 1.18 module on FreeBSD, I get the following error :
wrkdirs/usr/ports/www/nginx/work/lua-nginx-module-0.10.17/src/api -I objs -I src/http -I src/http/modules -I src/http/v2 -I /wrkdirs/usr/ports/www/nginx/work
/ngx_devel_kit-0.3.1/src -I src/mail -I src/stream -o objs/addon/naxsi_src/naxsi_net.o /wrkdirs/usr/ports/www/nginx/work/naxsi-1.1/naxsi_src/naxsi_net.c
/wrkdirs/usr/ports/www/nginx/work/naxsi-1.1/naxsi_src/naxsi_net.c:6:19: error: variable has incomplete type 'struct in6_addr'
struct in6_addr ipv6 = { .s6_addr = { 0 } };
^
/wrkdirs/usr/ports/www/nginx/work/naxsi-1.1/naxsi_src/naxsi_net.c:6:10: note: forward declaration of 'struct in6_addr'
struct in6_addr ipv6 = { .s6_addr = { 0 } };
^
/wrkdirs/usr/ports/www/nginx/work/naxsi-1.1/naxsi_src/naxsi_net.c:7:17: error: use of undeclared identifier 'AF_INET6'
if (inet_pton(AF_INET6, addr, &ipv6) != 1) {
^
/wrkdirs/usr/ports/www/nginx/work/naxsi-1.1/naxsi_src/naxsi_net.c:34:15: error: use of undeclared identifier 'AF_INET6'
inet_ntop(AF_INET6, &ipv6, ip_str, INET6_ADDRSTRLEN);
^
/wrkdirs/usr/ports/www/nginx/work/naxsi-1.1/naxsi_src/naxsi_net.c:43:17: error: use of undeclared identifier 'AF_INET'
if (inet_pton(AF_INET, addr, &ipv4) != 1) {
^
/wrkdirs/usr/ports/www/nginx/work/naxsi-1.1/naxsi_src/naxsi_net.c:52:15: error: use of undeclared identifier 'AF_INET'
inet_ntop(AF_INET, &ipv4, ip_str, INET_ADDRSTRLEN);
^
5 errors generated.
*** Error code 1
Stop.
make[2]: stopped in /wrkdirs/usr/ports/www/nginx/work/nginx-1.18.0
I fix the problem on FreeBSD by applying the following patch but have not verified if it's ok on other platforms :
$ diff -u naxsi_net.h.orig naxsi_net.h
--- naxsi_net.h.orig 2020-09-25 16:59:38.611639051 +0200
+++ naxsi_net.h 2020-09-25 16:59:17.399714993 +0200
@@ -7,6 +7,11 @@
#ifndef __NAXSI_NET_H__
#define __NAXSI_NET_H__
+#if defined(__FreeBSD__)
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+#endif
#include <arpa/inet.h>
#include <stdint.h>
#include <string.h>The needed .h on FreeBSD is described in man inet_network
In case it may help somebody
Metadata
Metadata
Assignees
Labels
No labels