ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-users: Re: [Wireshark-users] dragonflyBSD compiling failing from trunk

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Sun, 22 May 2016 19:10:12 -0700
On May 22, 2016, at 6:19 PM, jungle Boogie <jungleboogie0@xxxxxxxxx> wrote:

> Trying to build wireshark on my dragonflyBSD laptop with this dragonfly:
> DragonFly 4.5-DEVELOPMENT DragonFly v4.5.0.972.g240f0-DEVELOPMENT
> I'm on this commit:
> http://gitweb.dragonflybsd.org/dragonfly.git/commit/240f0ad6e4174ffec8892758ad94f744ef8a4970
> 
> In other words, very recent.

	...

>  CC       interface.lo
> interface.c: In function 'local_interfaces_to_list':
> interface.c:57:24: error: dereferencing pointer to incomplete type
> 'struct sockaddr'
>  family = ifa->ifa_addr->sa_family;
>                        ^
> interface.c:62:11: error: 'AF_INET' undeclared (first use in this function)
>      case AF_INET:
>           ^
> interface.c:62:11: note: each undeclared identifier is reported only
> once for each function it appears in
> interface.c:65:27: error: dereferencing pointer to incomplete type
> 'struct sockaddr_in'
>       ws_inet_ntop4(&addr4->sin_addr, ip, sizeof(ip));
>                           ^
> interface.c:69:11: error: 'AF_INET6' undeclared (first use in this function)
>      case AF_INET6:
>           ^
> interface.c:72:27: error: dereferencing pointer to incomplete type
> 'struct sockaddr_in6'
>       ws_inet_ntop6(&addr6->sin6_addr, ip, sizeof(ip));

	...

> What's causing this

DragonFly BSD's <arpa/inet.h> not including <netinet/in.h>.

> and what can I do correct it?

Do a "git pull" in your Wireshark tree and rebuild.

It looks as if OS X's <arpa/inet.h> include <netinet/in.h>, but DragonFly BSD's <arpa/inet.h> doesn't.  Presumably the Linuxes on which we build also have <arpa/inet.h> including something that eventually causes <netinet/in.h> to be included, and whatever is necessary happens on Windows with MSVC's header files as well.

But it's a bug to rely on that, so I've checked in a change to explicitly include <netinet/in.h>.