On Mon, Dec 17, 2012 at 7:36 PM, Steffen Dettmer
<steffen.dett...@gmail.com> wrote:
> the larger values I use for -l in UDP mode, the lower bandwidth
> is reported by iperf, incorrectly I think. With tcpdump I found
> that it really seems like iperf would calculate only with one IP
> fragement instead of the whole UDP packet.

I took a look to the sources and found issues with buffer handling.



1. usage tells:
     -l, --len       #[KM]    length of buffer to read or write (default 8 KB)
   but code tells:
     main->mBufLen       = 128 * 1024;      // -l,  8 Kbyte
     mExtSettings->mBufLen = kDefault_UDPBufLen;
     with const int  kDefault_UDPBufLen = 1470
   For the first one it could be that a bug entry already exists
   in a tracker.



2. recv is used with a buffer of that size, which is too small to
   take UDP packets in general (they can be up to almost 64KB),
   see man recv:

     If  a  message  is  too  long to fit in the supplied buffer,
     excess bytes may be discarded depending on the type of
     socket the  message is received from.

     [...]

     MSG_TRUNC
       Return the real length of the packet, even when  it  was  longer
       than the passed buffer.  Only valid for packet sockets.

  But MSG_TRUNC is not given.



3. patch idea

diff -Nur iperf-2.0.5.dist/src/Server.cpp iperf-2.0.5/src/Server.cpp
--- iperf-2.0.5.dist/src/Server.cpp     2012-12-17 20:03:54.000000000 +0100
+++ iperf-2.0.5/src/Server.cpp  2012-12-17 20:06:18.000000000 +0100
@@ -109,7 +109,7 @@
         mSettings->reporthdr = InitReport( mSettings );
         do {
             // perform read
-            currLen = recv( mSettings->mSock, mBuf, mSettings->mBufLen, 0 );
+            currLen = recv( mSettings->mSock, mBuf,
mSettings->mBufLen, MSG_TRUNC );

             if ( isUDP( mSettings ) ) {
                 // read the datagram ID and sentTime out of the buffer

(there are "trailing whitespace" issues in the sources
and thus in the patch, hope they remain correctly in this mail)

What do you think?

oki,

Steffen

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Iperf-users mailing list
Iperf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iperf-users

Reply via email to