Skip to content

Commit

Permalink
Fix build when lacking getifaddrs lacking
Browse files Browse the repository at this point in the history
  • Loading branch information
chouquette committed Jul 12, 2016
1 parent 37ee1d0 commit e4f39ea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ AC_CHECK_DECLS([CLOCK_MONOTONIC],,,[
AC_REPLACE_FUNCS([strlcpy])
AC_REPLACE_FUNCS([strndup])
AC_REPLACE_FUNCS([clock_gettime])
AC_CHECK_FUNCS([pipe _pipe])
AC_CHECK_FUNCS([pipe _pipe getifaddrs])

AC_CHECK_HEADERS([bsd/string.h langinfo.h alloca.h sys/queue.h arpa/inet.h sys/socket.h])
AC_CHECK_HEADERS([bsd/string.h langinfo.h alloca.h sys/queue.h arpa/inet.h sys/socket.h ifaddrs.h])

## Configure random device path
AC_ARG_WITH([urandom],
Expand Down
15 changes: 14 additions & 1 deletion src/netbios_ns.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@

#ifndef _WIN32
# include <sys/types.h>
# include <ifaddrs.h>
# ifdef HAVE_IFADDRS_H
# include <ifaddrs.h>
# endif
# include <net/if.h>
#endif

Expand Down Expand Up @@ -262,6 +264,8 @@ static ssize_t netbios_ns_send_packet(netbios_ns* ns, netbios_query* q, uint32_t

#ifndef _WIN32

#ifdef HAVE_GETIFADDRS

static void netbios_ns_broadcast_packet(netbios_ns* ns, netbios_query* q)
{
struct ifaddrs *addrs;
Expand All @@ -284,6 +288,15 @@ static void netbios_ns_broadcast_packet(netbios_ns* ns, netbios_query* q)

#else

static void netbios_ns_broadcast_packet(netbios_ns* ns, netbios_query* q)
{
netbios_ns_send_packet(ns, q, INADDR_BROADCAST);
}

#endif

#else

static void netbios_ns_broadcast_packet(netbios_ns* ns, netbios_query* q)
{
INTERFACE_INFO infolist[16];
Expand Down

0 comments on commit e4f39ea

Please sign in to comment.