summaryrefslogtreecommitdiff
blob: bef05259a4d8aae9b1d9c5d9c08aa81f6be3ccd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Description: Fix improper check for IPv6 family when sending multicast
 This patch fixes the proper behavior of -T (hop-limit setting) when
 sending IPv6 multicast packets. Due to this bug, it was always fixed to 1.
 .
 SetSocketOptions() is called before socket connection, thus sa_family is
 still set to 0. This is causing the if-branch in the multicast check
 to always assume a non-IPv6 socket.
 Checking the remote-peer family works reliably, instead.
Author: Luca Bruno <lucab@debian.org>
Last-Update: 2012-05-24

--- a/src/PerfSocket.cpp
+++ b/src/PerfSocket.cpp
@@ -109,7 +109,7 @@ void SetSocketOptions( thread_Settings *
     if ( isMulticast( inSettings ) && ( inSettings->mTTL > 0 ) ) {
 	int val = inSettings->mTTL;
 #ifdef HAVE_MULTICAST
-	if ( !SockAddr_isIPv6( &inSettings->local ) ) {
+	if ( !SockAddr_isIPv6( &inSettings->peer ) ) {
 	    int rc = setsockopt( inSettings->mSock, IPPROTO_IP, IP_MULTICAST_TTL,
 		    (const void*) &val, (Socklen_t) sizeof(val));