Merge pull request #41116 from tchaikov/wip-in_addr_t

common/pick_address: define in_addr_t if it is not defined

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
This commit is contained in:
Kefu Chai 2021-05-02 08:09:03 +08:00 committed by GitHub
commit 5093c6f36e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 1 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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

View File

@ -13,7 +13,11 @@
#endif
#include <arpa/inet.h>
#include <ifaddrs.h>
#ifdef _WIN32
#include <ws2tcpip.h>
#else
#include <net/if.h>
#endif
static void ipv4(struct sockaddr_in *addr, const char *s) {
int err;