Compiling with --enable-dnstap breaks on FreeBSD
--- libdnstap_la-convert.lo ---
CC libdnstap_la-convert.lo
--- libdnstap_la-dnstap.lo ---
CC libdnstap_la-dnstap.lo
--- libdnstap_la-message.lo ---
CC libdnstap_la-message.lo
--- libdnstap_la-reader.lo ---
CC libdnstap_la-reader.lo
--- libdnstap_la-writer.lo ---
CC libdnstap_la-writer.lo
--- libdnstap_la-dnstap.pb-c.lo ---
CC libdnstap_la-dnstap.pb-c.lo
--- libdnstap_la-convert.lo ---
In file included from convert.c:18:
/usr/include/netinet/ip.h:51:2: error: unknown type name 'u_char'; did you mean 'char'?
u_char ip_hl:4, /* header length */
^
/usr/include/netinet/ip.h:55:2: error: unknown type name 'u_char'; did you mean 'char'?
u_char ip_v:4, /* version */
^
/usr/include/netinet/ip.h:55:9: error: duplicate member 'ip_v'
u_char ip_v:4, /* version */
^
/usr/include/netinet/ip.h:52:3: note: previous declaration is here
ip_v:4; /* version */
^
/usr/include/netinet/ip.h:56:3: error: duplicate member 'ip_hl'
ip_hl:4; /* header length */
^
/usr/include/netinet/ip.h:51:9: note: previous declaration is here
u_char ip_hl:4, /* header length */
^
/usr/include/netinet/ip.h:58:2: error: unknown type name 'u_char'; did you mean 'char'?
u_char ip_tos; /* type of service */
^
/usr/include/netinet/ip.h:59:2: error: unknown type name 'u_short'; did you mean 'short'?
u_short ip_len; /* total length */
^
/usr/include/netinet/ip.h:60:2: error: unknown type name 'u_short'; did you mean 'short'?
u_short ip_id; /* identification */
^
/usr/include/netinet/ip.h:61:2: error: unknown type name 'u_short'; did you mean 'short'?
u_short ip_off; /* fragment offset field */
^
/usr/include/netinet/ip.h:66:2: error: unknown type name 'u_char'; did you mean 'char'?
u_char ip_ttl; /* time to live */
^
--- libdnstap_la-dnstap.lo ---
dnstap.c:26:32: warning: suggest braces around initialization of subobject [-Wmissing-braces]
--- libdnstap_la-convert.lo ---
/usr/include/netinet/ip.h:67:2: error: unknown type name 'u_char'; did you mean 'char'?
u_char ip_p; /* protocol */
^
--- libdnstap_la-dnstap.lo ---
ProtobufCBufferSimple sbuf = {0};
^
{}
--- libdnstap_la-convert.lo ---
/usr/include/netinet/ip.h:68:2: error: unknown type name 'u_short'; did you mean 'short'?
u_short ip_sum; /* checksum */
^
/usr/include/netinet/ip.h:69:17: error: field has incomplete type 'struct in_addr'
struct in_addr ip_src,ip_dst; /* source and dest address */
^
/usr/include/netinet/ip.h:69:9: note: forward declaration of 'struct in_addr'
struct in_addr ip_src,ip_dst; /* source and dest address */
^
/usr/include/netinet/ip.h:69:24: error: field has incomplete type 'struct in_addr'
struct in_addr ip_src,ip_dst; /* source and dest address */
^
/usr/include/netinet/ip.h:69:9: note: forward declaration of 'struct in_addr'
struct in_addr ip_src,ip_dst; /* source and dest address */
^
/usr/include/netinet/ip.h:166:2: error: unknown type name 'u_char'; did you mean 'char'?
u_char ipt_code; /* IPOPT_TS */
^
/usr/include/netinet/ip.h:167:2: error: unknown type name 'u_char'; did you mean 'char'?
u_char ipt_len; /* size of structure (variable) */
^
/usr/include/netinet/ip.h:168:2: error: unknown type name 'u_char'; did you mean 'char'?
u_char ipt_ptr; /* index of current entry */
^
/usr/include/netinet/ip.h:170:2: error: unknown type name 'u_char'; did you mean 'char'?
u_char ipt_flg:4, /* flags, see below */
^
/usr/include/netinet/ip.h:174:2: error: unknown type name 'u_char'; did you mean 'char'?
u_char ipt_oflw:4, /* overflow counter */
^
/usr/include/netinet/ip.h:174:9: error: duplicate member 'ipt_oflw'
u_char ipt_oflw:4, /* overflow counter */
^
/usr/include/netinet/ip.h:171:3: note: previous declaration is here
ipt_oflw:4; /* overflow counter */
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
--- libdnstap_la-dnstap.lo ---
1 warning generated.
--- libdnstap_la-convert.lo ---
20 errors generated.
*** [libdnstap_la-convert.lo] Error code 1
You have to start src/dnstap/convert.c with these to fix it:
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/ip.h>