diff options
author | Benoit Foucher <benoit@zeroc.com> | 2013-02-20 18:49:30 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2013-02-20 18:49:30 +0100 |
commit | c24099b460c4b2e83124d0aa8e51ba9bdd899a05 (patch) | |
tree | deaa3b37bded5ffacb7bca58bdbdd0aac022cc58 /cpp | |
parent | Fixed (ICE-5270) - "Documents\ZeroC\IceGridGUI" renamed "Documents\ZeroC\IceG... (diff) | |
download | ice-c24099b460c4b2e83124d0aa8e51ba9bdd899a05.tar.bz2 ice-c24099b460c4b2e83124d0aa8e51ba9bdd899a05.tar.xz ice-c24099b460c4b2e83124d0aa8e51ba9bdd899a05.zip |
Fixed ICE-5263 - IPv6 support for Windows XP
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/Network.cpp | 6 | ||||
-rw-r--r-- | cpp/test/Ice/binding/AllTests.cpp | 12 |
2 files changed, 17 insertions, 1 deletions
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index 9754769479a..e60712ab51a 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -868,6 +868,12 @@ IceInternal::createServerSocket(bool udp, const Address& addr, ProtocolSupport p int flag = protocol == EnableIPv6 ? 1 : 0; if(setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR) { +#ifdef _WIN32 + if(getSocketErrno() == WSAENOPROTOOPT) + { + return fd; // Windows XP doesn't support IPV6_V6ONLY + } +#endif closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); diff --git a/cpp/test/Ice/binding/AllTests.cpp b/cpp/test/Ice/binding/AllTests.cpp index ee644b05702..52af48ab5ec 100644 --- a/cpp/test/Ice/binding/AllTests.cpp +++ b/cpp/test/Ice/binding/AllTests.cpp @@ -845,7 +845,16 @@ allTests(const Ice::CommunicatorPtr& communicator) serverProps.push_back(anyboth); serverProps.push_back(localipv4); serverProps.push_back(localipv6); - + +#ifdef _WIN32 + OSVERSIONINFO ver; + ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&ver); + const bool dualStack = ver.dwMajorVersion >= 6; // Windows XP IPv6 doesn't support dual-stack +#else + const bool dualStack = true; +#endif + bool ipv6NotSupported = false; for(vector<Ice::PropertiesPtr>::const_iterator p = serverProps.begin(); p != serverProps.end(); ++p) { @@ -901,6 +910,7 @@ allTests(const Ice::CommunicatorPtr& communicator) (*p == bothPreferIPv4 && *q == ipv6) || (*p == bothPreferIPv6 && *q == ipv4) || (*p == bothPreferIPv6 && *q == ipv6 && ipv6NotSupported) || (*p == anyipv4 && *q == ipv6) || (*p == anyipv6 && *q == ipv4) || + (*p == anyboth && *q == ipv4 && !dualStack) || (*p == localipv4 && *q == ipv6) || (*p == localipv6 && *q == ipv4)); continue; } |