Skip to content

Commit

Permalink
posix IPv6: BSD platforms us netinet6/in6.h
Browse files Browse the repository at this point in the history
  • Loading branch information
gdamore committed Dec 22, 2024
1 parent ebcd44e commit ec709cc
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/platform/posix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ if (NNG_PLATFORM_POSIX)
nng_check_sym(atomic_flag_test_and_set stdatomic.h NNG_HAVE_STDATOMIC)
nng_check_sym(socketpair sys/socket.h NNG_HAVE_SOCKETPAIR)
nng_check_sym(AF_INET6 netinet/in.h NNG_HAVE_INET6)
nng_check_sym(AF_INET6 netinet6/in6.h NNG_HAVE_INET6_BSD)
nng_check_sym(timespec_get time.h NNG_HAVE_TIMESPEC_GET)
nng_check_sym(getentropy sys/random.h NNG_HAVE_SYS_RANDOM)

Expand Down
5 changes: 5 additions & 0 deletions src/platform/posix/posix_resolv_gai.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@
#endif

#ifndef NNG_HAVE_INET6
#ifdef HAVE_NNG_HAVE_INET6_BSD
#define NNG_HAVE_INET6
#include <netinet6/in6.h>
#else
#undef NNG_ENABLE_IPV6
#endif
#endif

static nni_mtx resolv_mtx = NNI_MTX_INITIALIZER;
static nni_cv resolv_cv = NNI_CV_INITIALIZER(&resolv_mtx);
Expand Down
5 changes: 5 additions & 0 deletions src/platform/posix/posix_sockaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@
#include <sys/un.h>

#ifndef NNG_HAVE_INET6
#ifdef HAVE_NNG_HAVE_INET6_BSD
#define NNG_HAVE_INET6
#include <netinet6/in6.h>
#else
#undef NNG_ENABLE_IPV6
#endif
#endif

size_t
nni_posix_nn2sockaddr(void *sa, const nni_sockaddr *na)
Expand Down
5 changes: 5 additions & 0 deletions src/platform/posix/posix_tcpdial.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@
#include "posix_tcp.h"

#ifndef NNG_HAVE_INET6
#ifdef HAVE_NNG_HAVE_INET6_BSD
#define NNG_HAVE_INET6
#include <netinet6/in6.h>
#else
#undef NNG_ENABLE_IPV6
#endif
#endif

// Dialer stuff.
int
Expand Down
5 changes: 5 additions & 0 deletions src/platform/posix/posix_tcplisten.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@
#endif

#ifndef NNG_HAVE_INET6
#ifdef HAVE_NNG_HAVE_INET6_BSD
#define NNG_HAVE_INET6
#include <netinet6/in6.h>
#else
#undef NNG_ENABLE_IPV6
#endif
#endif

#include "posix_tcp.h"

Expand Down
5 changes: 5 additions & 0 deletions src/platform/posix/posix_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@
#endif

#ifndef NNG_HAVE_INET6
#ifdef HAVE_NNG_HAVE_INET6_BSD
#define NNG_HAVE_INET6
#include <netinet6/in6.h>
#else
#undef NNG_ENABLE_IPV6
#endif
#endif

// Linux has IPV6_ADD_MEMBERSHIP and IPV6_DROP_MEMBERSHIP
#ifndef IPV6_JOIN_GROUP
Expand Down

0 comments on commit ec709cc

Please sign in to comment.