summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2012-04-03 22:55:46 +0000
committerSteve Huston <shuston@riverace.com>2012-04-03 22:55:46 +0000
commit2897c87e6f9a32e3b75c7fa2bc2eb96a6647afcb (patch)
tree545842573f225caaaf5954e6d9fede009470a8ef
parent98f80f43d5dbb7dd30338ac8c6c18b67b62c23a6 (diff)
downloadATCD-2897c87e6f9a32e3b75c7fa2bc2eb96a6647afcb.tar.gz
ChangeLogTag:Tue Apr 3 22:49:11 UTC 2012 Steve Huston <shuston@riverace.com>
-rw-r--r--ACE/ChangeLog10
-rw-r--r--ACE/ace/SOCK_Dgram_Mcast.cpp16
2 files changed, 23 insertions, 3 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index acc58715c68..07b02982e3d 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,13 @@
+Tue Apr 3 22:49:11 UTC 2012 Steve Huston <shuston@riverace.com>
+
+ * ace/SOCK_Dgram_Mcast.cpp (subscribe_ifs): Set the error code when
+ a Windows API call fails. Also, when calling GetAdaptersAddresses()
+ to both check size and get the info, supply GAA_FLAG_SKIP_MULTICAST
+ as the flag value. This avoids obtaining info for joined multicast
+ addresses, not multicastable interfaces. Without the flag, and if
+ some other process does a join between the size-check call and the
+ info-gathering call, the size will be wrong.
+
Tue Apr 3 17:01:33 UTC 2012 Jeff Parsons <j.parsons@vanderbilt.edu>
* THANKS:
diff --git a/ACE/ace/SOCK_Dgram_Mcast.cpp b/ACE/ace/SOCK_Dgram_Mcast.cpp
index 9e968a47663..a5d5e5e0c16 100644
--- a/ACE/ace/SOCK_Dgram_Mcast.cpp
+++ b/ACE/ace/SOCK_Dgram_Mcast.cpp
@@ -327,12 +327,21 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
// Initial call to determine actual memory size needed
DWORD dwRetVal;
ULONG bufLen = 0;
+ // Note... GetAdaptersAddresses returns different bufLen values depending
+ // on how many multicast joins there are on the system. To avoid this,
+ // specify that we don't want to know about multicast addresses. This
+ // does not avoid multicastable interfaces and makes the size-check
+ // more reliable across varying conditions.
+ DWORD flags = GAA_FLAG_SKIP_MULTICAST;
if ((dwRetVal = ::GetAdaptersAddresses (family,
- 0,
+ flags,
0,
&tmp_addrs,
&bufLen)) != ERROR_BUFFER_OVERFLOW)
- return -1; // With output bufferlength 0 this can't be right.
+ {
+ errno = dwRetVal;
+ return -1; // With output bufferlength 0 this can't be right.
+ }
// Get required output buffer and retrieve info for real.
PIP_ADAPTER_ADDRESSES pAddrs;
@@ -342,12 +351,13 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
-1);
pAddrs = reinterpret_cast<PIP_ADAPTER_ADDRESSES> (buf);
if ((dwRetVal = ::GetAdaptersAddresses (family,
- 0,
+ flags,
0,
pAddrs,
&bufLen)) != NO_ERROR)
{
delete[] buf; // clean up
+ errno = dwRetVal;
return -1;
}