pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/41887?usp=email )

Change subject: Detect struct in6_addr.s6_addr32 via AC_CHECK_MEMBER and use 
HAVE_IN6_ADDR_S6_ADDR32 instead of __linux__.
......................................................................

Detect struct in6_addr.s6_addr32 via AC_CHECK_MEMBER and use 
HAVE_IN6_ADDR_S6_ADDR32 instead of __linux__.

No functional changes intended, this is a preparatory refactor to keep
follow-up patches focused and easier to review.

Change-Id: I29385fde0f1e6c6cc73cd1488befdef9040cc28e
---
M configure.ac
M src/core/socket.c
2 files changed, 8 insertions(+), 1 deletion(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve




diff --git a/configure.ac b/configure.ac
index 64690f9..4a6a474 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,6 +86,13 @@
 AC_CHECK_LIB(execinfo, backtrace, BACKTRACE_LIB=-lexecinfo, BACKTRACE_LIB=)
 AC_SUBST(BACKTRACE_LIB)

+# check for struct in6_addr has s6_addr32 field
+AC_CHECK_MEMBER([struct in6_addr.s6_addr32],
+               [AC_DEFINE([HAVE_IN6_ADDR_S6_ADDR32], [1],
+                               [Define if struct in6_addr has s6_addr32 
field])],
+               [],
+               [[#include <netinet/in.h>]])
+
 # check for pthread (PTHREAD_CFLAGS, PTHREAD_LIBS)
 AX_PTHREAD

diff --git a/src/core/socket.c b/src/core/socket.c
index bb32185..2de4bb3 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1695,7 +1695,7 @@

 static unsigned int in6_addr_netmask_to_prefixlen(const struct in6_addr 
*netmask)
 {
-       #if defined(__linux__)
+       #if (HAVE_IN6_ADDR_S6_ADDR32)
                #define ADDRFIELD(i) s6_addr32[i]
        #else
                #define ADDRFIELD(i) __u6_addr.__u6_addr32[i]

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41887?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I29385fde0f1e6c6cc73cd1488befdef9040cc28e
Gerrit-Change-Number: 41887
Gerrit-PatchSet: 2
Gerrit-Owner: Timur Davydov <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to