This is an automated email from the ASF dual-hosted git repository.

bbender pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new 55e0a76  GEODE-7180: Disable IPv6 support by default (#518)
55e0a76 is described below

commit 55e0a7659427fb72f3b312cd226035edf8f5cc1a
Author: Blake Bender <bben...@pivotal.io>
AuthorDate: Thu Sep 12 11:03:19 2019 -0700

    GEODE-7180: Disable IPv6 support by default (#518)
    
    * GEODE-7180: Disable IPv6 support in ACE via ifdef
    * Fix cmake option name to agree with ifdef
    * Change define from WITH_IPV6 to USE_IPV6, for consistency with others
    * Also use cmakedefine in ACE config file
    * verified WITH_IPV6 can be switched to turn support on/off
    
    Co-authored-by: Vince Ford <vfordpivo...@pivotal.io>
---
 CMakeLists.txt               | 1 +
 cppcache/src/PoolFactory.cpp | 4 ++++
 cppcache/src/TcpConn.cpp     | 4 ++++
 cppcache/src/config.h.in     | 2 ++
 dependencies/ACE/config.h.in | 3 +++
 5 files changed, 14 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3dd50c..8a0b33f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,7 @@ project(nativeclient LANGUAGES C CXX)
 option(USE_PCH "Use precompiled headers (PCH)." OFF)
 option(USE_CPP_COVERAGE "Enable profiling and coverage report analysis for 
apache-geode cpp library." OFF)
 option(USE_RAT "Enable Apache Rat checking." OFF)
+option(WITH_IPV6 "Enable IPv6 support." OFF)
 
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
 
diff --git a/cppcache/src/PoolFactory.cpp b/cppcache/src/PoolFactory.cpp
index 1f42345..9a5908f 100644
--- a/cppcache/src/PoolFactory.cpp
+++ b/cppcache/src/PoolFactory.cpp
@@ -308,6 +308,7 @@ PoolFactory& PoolFactory::addCheck(const std::string& host, 
int port) {
   }
 
   ACE_INET_Addr addr(port, host.c_str());
+#ifdef WITH_IPV6
   // check unknown host
   const int maxlength = 256;
   const int maxhostlength = 256;
@@ -319,6 +320,9 @@ PoolFactory& PoolFactory::addCheck(const std::string& host, 
int port) {
 
   if ((strcmp(char_localhost, host.c_str()) != 0) &&
       (strcmp(char_localhost, char_array) == 0)) {
+#else
+  if (!(addr.get_ip_address())) {
+#endif
     throw IllegalArgumentException("Unknown host " + host);
   }
   return *this;
diff --git a/cppcache/src/TcpConn.cpp b/cppcache/src/TcpConn.cpp
index 7cee9ab..95d101f 100644
--- a/cppcache/src/TcpConn.cpp
+++ b/cppcache/src/TcpConn.cpp
@@ -94,7 +94,11 @@ void TcpConn::createSocket(ACE_HANDLE sock) {
 }
 
 void TcpConn::init() {
+#ifdef WITH_IPV6
   ACE_HANDLE sock = ACE_OS::socket(m_addr.get_type(), SOCK_STREAM, 0);
+#else
+  ACE_HANDLE sock = ACE_OS::socket(AF_INET, SOCK_STREAM, 0);
+#endif
   if (sock == ACE_INVALID_HANDLE) {
     int32_t lastError = ACE_OS::last_error();
     LOGERROR("Failed to create socket. Errno: %d: %s", lastError,
diff --git a/cppcache/src/config.h.in b/cppcache/src/config.h.in
index c2a283f..e511793 100644
--- a/cppcache/src/config.h.in
+++ b/cppcache/src/config.h.in
@@ -55,4 +55,6 @@
 #define ACE_Thread_NULL 0
 #endif
 
+#cmakedefine WITH_IPV6
+
 #endif  // GEODE_CONFIG_H_
diff --git a/dependencies/ACE/config.h.in b/dependencies/ACE/config.h.in
index 46d56ae..b6ee2e8 100755
--- a/dependencies/ACE/config.h.in
+++ b/dependencies/ACE/config.h.in
@@ -27,7 +27,10 @@
 
 #endif // __cplusplus >= 201103L
 
+#cmakedefine WITH_IPV6
+#ifdef WITH_IPV6
 #define ACE_HAS_IPV6 1
+#endif
 
 #include "ace/config-@ACE_CONFIG@.h"
 

Reply via email to