diff --git a/cmake/modules/CephChecks.cmake b/cmake/modules/CephChecks.cmake index 46b50b387c7..26a5d0bcd7a 100644 --- a/cmake/modules/CephChecks.cmake +++ b/cmake/modules/CephChecks.cmake @@ -56,7 +56,7 @@ endif() CHECK_INCLUDE_FILES("valgrind/helgrind.h" HAVE_VALGRIND_HELGRIND_H) include(CheckTypeSize) -set(CMAKE_EXTRA_INCLUDE_FILES "linux/types.h") +set(CMAKE_EXTRA_INCLUDE_FILES "linux/types.h" "netinet/in.h") CHECK_TYPE_SIZE(__u8 __U8) CHECK_TYPE_SIZE(__u16 __U16) CHECK_TYPE_SIZE(__u32 __U32) @@ -65,6 +65,7 @@ CHECK_TYPE_SIZE(__s8 __S8) CHECK_TYPE_SIZE(__s16 __S16) CHECK_TYPE_SIZE(__s32 __S32) CHECK_TYPE_SIZE(__s64 __S64) +CHECK_TYPE_SIZE(in_addr_t IN_ADDR_T) unset(CMAKE_EXTRA_INCLUDE_FILES) include(CheckSymbolExists) diff --git a/src/common/pick_address.cc b/src/common/pick_address.cc index bf40daf2b16..203e1d63f17 100644 --- a/src/common/pick_address.cc +++ b/src/common/pick_address.cc @@ -34,6 +34,14 @@ #include "common/errno.h" #include "common/numa.h" +#ifndef HAVE_IN_ADDR_T +typedef uint32_t in_addr_t; +#endif + +#ifndef IN_LOOPBACKNET +#define IN_LOOPBACKNET 127 +#endif + #define dout_subsys ceph_subsys_ using std::string; diff --git a/src/include/config-h.in.cmake b/src/include/config-h.in.cmake index 013d62d613f..504ff525ba9 100644 --- a/src/include/config-h.in.cmake +++ b/src/include/config-h.in.cmake @@ -63,6 +63,9 @@ /* Define to 1 if the system has the type `__u8'. */ #cmakedefine HAVE___U8 1 +/* Define if the system has the type `in_addr_t' */ +#cmakedefine HAVE_IN_ADDR_T + /* Define if you have res_nquery */ #cmakedefine HAVE_RES_NQUERY diff --git a/src/test/test_ipaddr.cc b/src/test/test_ipaddr.cc index 56a16644ed5..f98560f817d 100644 --- a/src/test/test_ipaddr.cc +++ b/src/test/test_ipaddr.cc @@ -13,7 +13,11 @@ #endif #include #include +#ifdef _WIN32 +#include +#else #include +#endif static void ipv4(struct sockaddr_in *addr, const char *s) { int err;