diff options
author | Steve Huston <shuston@riverace.com> | 2018-04-10 18:43:02 -0400 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2022-03-23 20:54:35 +0000 |
commit | a1edea77d6486f10b70b965b99b387261aefd878 (patch) | |
tree | dd7427bfe3372a7f27a7d905840d323ab6ef5863 | |
parent | 127601149f87bd0d6263137e10438bce0bf2c102 (diff) | |
download | ATCD-a1edea77d6486f10b70b965b99b387261aefd878.tar.gz |
Pull changes from master; remove addr_any restriction from ipv6_only UDP
This is an additional fix stemming from Riverace case 2088
-rw-r--r-- | ACE/ace/SOCK_Acceptor.cpp | 20 | ||||
-rw-r--r-- | ACE/ace/SOCK_Dgram.cpp | 27 |
2 files changed, 23 insertions, 24 deletions
diff --git a/ACE/ace/SOCK_Acceptor.cpp b/ACE/ace/SOCK_Acceptor.cpp index c329029e33a..3c3673f2b6c 100644 --- a/ACE/ace/SOCK_Acceptor.cpp +++ b/ACE/ace/SOCK_Acceptor.cpp @@ -226,7 +226,7 @@ ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap, ACE_TRACE ("ACE_SOCK_Acceptor::shared_open"); int error = 0; -#if !defined (ACE_HAS_IPV6) || (!defined (IPPROTO_IPV6) || !defined (IPV6_V6ONLY)) +#if !defined (ACE_HAS_IPV6) ACE_UNUSED_ARG (ipv6_only); #else /* !defined (ACE_HAS_IPV6) || (!defined (IPPROTO_IPV6) || !defined (IPV6_V6ONLY)) */ if (protocol_family == PF_INET6) @@ -251,7 +251,6 @@ ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap, * This must be done before attempting to bind the address. * On Windows older than Vista this will fail. */ -# if defined (IPPROTO_IPV6) && defined (IPV6_V6ONLY) int setting = !!ipv6_only; if (-1 == ACE_OS::setsockopt (this->get_handle (), IPPROTO_IPV6, @@ -260,17 +259,16 @@ ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap, sizeof (setting))) error = 1; else -# endif /* IPPROTO_V6 && IPV6_ONLY */ - // We probably don't need a bind_port written here. - // There are currently no supported OS's that define - // ACE_LACKS_WILDCARD_BIND. - if (ACE_OS::bind (this->get_handle (), - reinterpret_cast<sockaddr *> (&local_inet6_addr), - sizeof local_inet6_addr) == -1) - error = 1; + // We probably don't need a bind_port written here. + // There are currently no supported OS's that define + // ACE_LACKS_WILDCARD_BIND. + if (ACE_OS::bind (this->get_handle (), + reinterpret_cast<sockaddr *> (&local_inet6_addr), + sizeof local_inet6_addr) == -1) + error = 1; } else -#endif /* !defined (ACE_HAS_IPV6) || (!defined (IPPROTO_IPV6) || !defined (IPV6_V6ONLY)) */ +#endif /* ACE_HAS_IPV6 */ if (protocol_family == PF_INET) { sockaddr_in local_inet_addr; diff --git a/ACE/ace/SOCK_Dgram.cpp b/ACE/ace/SOCK_Dgram.cpp index db332165be8..7cab9cf7f81 100644 --- a/ACE/ace/SOCK_Dgram.cpp +++ b/ACE/ace/SOCK_Dgram.cpp @@ -109,23 +109,24 @@ ACE_SOCK_Dgram::shared_open (const ACE_Addr &local, { ACE_TRACE ("ACE_SOCK_Dgram::shared_open"); bool error = false; -#if !defined (ACE_HAS_IPV6) || (!defined (IPPROTO_IPV6) || !defined (IPV6_V6ONLY)) +#if defined (ACE_HAS_IPV6) + int setting = !!ipv6_only; + if (protocol_family == PF_INET6 && + -1 == ACE_OS::setsockopt (this->get_handle (), + IPPROTO_IPV6, + IPV6_V6ONLY, + (char *)&setting, + sizeof (setting))) + { + this->close(); + return -1; + } +#else ACE_UNUSED_ARG (ipv6_only); -#endif /* !defined (ACE_HAS_IPV6) || (!defined (IPPROTO_IPV6) || !defined (IPV6_V6ONLY)) */ +#endif /* defined (ACE_HAS_IPV6) */ if (local == ACE_Addr::sap_any) { -#if defined (ACE_HAS_IPV6) && defined (IPPROTO_IPV6) && defined (IPV6_V6ONLY) - int setting = !!ipv6_only; - if (-1 == ACE_OS::setsockopt (this->get_handle (), - IPPROTO_IPV6, - IPV6_V6ONLY, - (char *)&setting, - sizeof (setting))) - error = true; - else -#endif /* ACE_HAS_IPV6 && IPPROTO_IPV6 && IPV6_V6ONLY */ - if (protocol_family == PF_INET #if defined (ACE_HAS_IPV6) || protocol_family == PF_INET6 |