Skip to content

Commit e4f39ea

Browse files
committed
Fix build when lacking getifaddrs lacking
1 parent 37ee1d0 commit e4f39ea

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

configure.ac

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ AC_CHECK_DECLS([CLOCK_MONOTONIC],,,[
105105
AC_REPLACE_FUNCS([strlcpy])
106106
AC_REPLACE_FUNCS([strndup])
107107
AC_REPLACE_FUNCS([clock_gettime])
108-
AC_CHECK_FUNCS([pipe _pipe])
108+
AC_CHECK_FUNCS([pipe _pipe getifaddrs])
109109

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

112112
## Configure random device path
113113
AC_ARG_WITH([urandom],

src/netbios_ns.c

+14-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@
5959

6060
#ifndef _WIN32
6161
# include <sys/types.h>
62-
# include <ifaddrs.h>
62+
# ifdef HAVE_IFADDRS_H
63+
# include <ifaddrs.h>
64+
# endif
6365
# include <net/if.h>
6466
#endif
6567

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

263265
#ifndef _WIN32
264266

267+
#ifdef HAVE_GETIFADDRS
268+
265269
static void netbios_ns_broadcast_packet(netbios_ns* ns, netbios_query* q)
266270
{
267271
struct ifaddrs *addrs;
@@ -284,6 +288,15 @@ static void netbios_ns_broadcast_packet(netbios_ns* ns, netbios_query* q)
284288

285289
#else
286290

291+
static void netbios_ns_broadcast_packet(netbios_ns* ns, netbios_query* q)
292+
{
293+
netbios_ns_send_packet(ns, q, INADDR_BROADCAST);
294+
}
295+
296+
#endif
297+
298+
#else
299+
287300
static void netbios_ns_broadcast_packet(netbios_ns* ns, netbios_query* q)
288301
{
289302
INTERFACE_INFO infolist[16];

0 commit comments

Comments
 (0)