Import Debian patches and fix a lot of real bugs. Upstream-Status: Inappropriate [not author. Above message was get from oe.dev c10c33f86903c93611023197a7f812459c2dfe2d] --- iperf-2.0.4-4/AUTHORS 2009-07-06 12:02:24.159696747 +0200 +++ iperf-2.0.4/AUTHORS 2009-07-06 12:14:32.236079541 +0200 @@ -28,3 +28,7 @@ Stephen Hemminger * Linux congestion control selection and theading improvements + +Nathan Jones + * patch for underflow when value specified in -n is not a multiple of -l + --- iperf-2.0.4-4/ChangeLog 2009-07-06 12:02:24.166276642 +0200 +++ iperf-2.0.4/ChangeLog 2009-07-06 12:15:28.883699655 +0200 @@ -1,3 +1,18 @@ +2008-05-09 Jon Dugan + +* change currLen to unsigned to squelch warning generated by Nathan's patch + +2008-05-09 Nathan Jones + +* prevent underflow when the amount of data to be transmitted (-n) is not a +multiple of the buffer size (-l) Patch: +https://sourceforge.net/tracker/index.php?func=detail&aid=1943432&group_id=128336&atid=711373 + +2008-04-08 Jon Dugan + +* print report headers only once +* use appropriate report header for UDP tests + 2008-04-07 Jon Dugan * Add man page to autoconf goo diff -urN 204orig/src/Client.cpp trunk/src/Client.cpp --- 204orig/src/Client.cpp 2008-04-08 04:37:54.000000000 +0200 +++ trunk/src/Client.cpp 2008-05-10 05:18:35.000000000 +0200 @@ -116,7 +116,7 @@ const int kBytes_to_Bits = 8; void Client::RunTCP( void ) { - long currLen = 0; + unsigned long currLen = 0; struct itimerval it; max_size_t totLen = 0; @@ -170,7 +170,12 @@ } if ( !mMode_Time ) { - mSettings->mAmount -= currLen; + /* mAmount may be unsigned, so don't let it underflow! */ + if( mSettings->mAmount >= currLen ) { + mSettings->mAmount -= currLen; + } else { + mSettings->mAmount = 0; + } } } while ( ! (sInterupted || @@ -198,7 +203,7 @@ void Client::Run( void ) { struct UDP_datagram* mBuf_UDP = (struct UDP_datagram*) mBuf; - long currLen = 0; + unsigned long currLen = 0; int delay_target = 0; int delay = 0; @@ -310,7 +315,12 @@ delay_loop( delay ); } if ( !mMode_Time ) { - mSettings->mAmount -= currLen; + /* mAmount may be unsigned, so don't let it underflow! */ + if( mSettings->mAmount >= currLen ) { + mSettings->mAmount -= currLen; + } else { + mSettings->mAmount = 0; + } } } while ( ! (sInterupted || diff -urN 204orig/src/ReportDefault.c trunk/src/ReportDefault.c --- 204orig/src/ReportDefault.c 2008-04-08 04:37:54.000000000 +0200 +++ trunk/src/ReportDefault.c 2008-04-09 02:08:11.000000000 +0200 @@ -67,6 +67,7 @@ * Prints transfer reports in default style */ void reporter_printstats( Transfer_Info *stats ) { + static char header_printed = 0; byte_snprintf( buffer, sizeof(buffer)/2, (double) stats->TotalLen, toupper( stats->mFormat)); @@ -76,13 +77,19 @@ if ( stats->mUDP != (char)kMode_Server ) { // TCP Reporting - printf( report_bw_header); + if( !header_printed ) { + printf( report_bw_header); + header_printed = 1; + } printf( report_bw_format, stats->transferID, stats->startTime, stats->endTime, buffer, &buffer[sizeof(buffer)/2] ); } else { // UDP Reporting - printf( report_bw_jitter_loss_header); + if( !header_printed ) { + printf( report_bw_jitter_loss_header); + header_printed = 1; + } printf( report_bw_jitter_loss_format, stats->transferID, stats->startTime, stats->endTime, buffer, &buffer[sizeof(buffer)/2],