Package:  iperf
Version:  2.0.5-1
Severity: normal
Tags:     patch ipv6

Currently, hop-limit for IPv6 multicast is not set even if the -T
switch is correctly set, for example:

$ iperf -V -u -n 10 -T 15 -c ff1e::4321
------------------------------------------------------------
Client connecting to ff1e::4321, UDP port 5001
Sending 1470 byte datagrams
Setting multicast TTL to 15
UDP buffer size:  224 KByte (default)
------------------------------------------------------------
[  3] local 2a02:8420:40a4:a00:2e81:58ff:fef7:1456 port 49759 connected with 
ff1e::4321 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 0.0 sec  1.44 KBytes  1.03 Mbits/sec
[  3] Sent 1 datagrams

This results in a capture where the hop-limit is nonetheless 1, as 
shown by tcpdump:

IP6 (hlim 1, next-header Fragment (44) payload length: 1456) XXX > ff1e::4321: 
frag(0xc238db25:0|1448) 49759 > 5001: UDP, length 1470

This is due to an improper check on local socket family before 
connection. The attached patch fixes this bug, checking the family
of the remote peer instead.

It builds fine and is tested to be working. I'd like to see it shipped in
Wheezy, if possible. I can volunteer for an NMU, if needed.

Cheers, Luca

-- 
  .''`.  |               ~<[ Luca BRUNO ~ (kaeso) ]>~
 : :'  : | Email: lucab (AT) debian.org ~ Debian Developer
 `. `'`  | GPG Key ID: 0x3BFB9FB3       ~ Free Software supporter
   `-    | HAM-radio callsign: IZ1WGT   ~ Networking sorcerer
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 <lu...@debian.org>
Last-Update: 2012-05-24

--- iperf-2.0.5.orig/src/PerfSocket.cpp
+++ iperf-2.0.5/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));
 

Attachment: signature.asc
Description: PGP signature

Reply via email to