[iperf/f19] patch to exit on port bind failure (#1047172, #1047569)
Gabriel L. Somlo
somlo at fedoraproject.org
Fri Jan 3 20:10:27 UTC 2014
commit 7e5050e1eb5f69bd21c8546ad36097beaba3b69f
Author: Gabriel L. Somlo <somlo at cmu.edu>
Date: Fri Jan 3 15:09:03 2014 -0500
patch to exit on port bind failure (#1047172, #1047569)
iperf-2.0.5-bind_fail.patch | 43 ++++++++++++
iperf-2.0.5-format_security.patch | 128 +++++++++++++++++++++++++++++++++++++
iperf.spec | 12 +++-
3 files changed, 182 insertions(+), 1 deletions(-)
---
diff --git a/iperf-2.0.5-bind_fail.patch b/iperf-2.0.5-bind_fail.patch
new file mode 100644
index 0000000..843fdaf
--- /dev/null
+++ b/iperf-2.0.5-bind_fail.patch
@@ -0,0 +1,43 @@
+diff -NarU5 a/src/Client.cpp b/src/Client.cpp
+--- a/src/Client.cpp 2010-04-01 16:23:17.000000000 -0400
++++ b/src/Client.cpp 2014-01-03 13:40:53.367873006 -0500
+@@ -395,21 +395,21 @@
+ AF_INET
+ #endif
+ : AF_INET);
+
+ mSettings->mSock = socket( domain, type, 0 );
+- WARN_errno( mSettings->mSock == INVALID_SOCKET, "socket" );
++ FAIL_errno( mSettings->mSock == INVALID_SOCKET, "socket", mSettings );
+
+ SetSocketOptions( mSettings );
+
+
+ SockAddr_localAddr( mSettings );
+ if ( mSettings->mLocalhost != NULL ) {
+ // bind socket to local address
+ rc = bind( mSettings->mSock, (sockaddr*) &mSettings->local,
+ SockAddr_get_sizeof_sockaddr( &mSettings->local ) );
+- WARN_errno( rc == SOCKET_ERROR, "bind" );
++ FAIL_errno( rc == SOCKET_ERROR, "bind", mSettings );
+ }
+
+ // connect socket
+ rc = connect( mSettings->mSock, (sockaddr*) &mSettings->peer,
+ SockAddr_get_sizeof_sockaddr( &mSettings->peer ));
+diff -NarU5 a/src/Listener.cpp b/src/Listener.cpp
+--- a/src/Listener.cpp 2007-08-29 17:57:27.000000000 -0400
++++ b/src/Listener.cpp 2014-01-03 13:40:07.161876165 -0500
+@@ -331,11 +331,11 @@
+ WARN_errno( rc == SOCKET_ERROR, "WSAJoinLeaf (aka bind)" );
+ } else
+ #endif
+ {
+ rc = bind( mSettings->mSock, (sockaddr*) &mSettings->local, mSettings->size_local );
+- WARN_errno( rc == SOCKET_ERROR, "bind" );
++ FAIL_errno( rc == SOCKET_ERROR, "bind", mSettings );
+ }
+ // listen for connections (TCP only).
+ // default backlog traditionally 5
+ if ( !isUDP( mSettings ) ) {
+ rc = listen( mSettings->mSock, 5 );
diff --git a/iperf-2.0.5-format_security.patch b/iperf-2.0.5-format_security.patch
new file mode 100644
index 0000000..86c3641
--- /dev/null
+++ b/iperf-2.0.5-format_security.patch
@@ -0,0 +1,128 @@
+diff -NarU5 A/compat/Thread.c B/compat/Thread.c
+--- A/compat/Thread.c 2010-03-30 19:08:24.000000000 -0400
++++ B/compat/Thread.c 2013-12-22 12:23:11.623088163 -0500
+@@ -379,11 +379,11 @@
+ * ------------------------------------------------------------------- */
+ int thread_release_nonterm( int interrupt ) {
+ Condition_Lock( thread_sNum_cond );
+ thread_sNum -= nonterminating_num;
+ if ( thread_sNum > 1 && nonterminating_num > 0 && interrupt != 0 ) {
+- fprintf( stderr, wait_server_threads );
++ fprintf( stderr, "%s", wait_server_threads );
+ }
+ nonterminating_num = 0;
+ Condition_Signal( &thread_sNum_cond );
+ Condition_Unlock( thread_sNum_cond );
+ return thread_sNum;
+diff -NarU5 A/src/ReportDefault.c B/src/ReportDefault.c
+--- A/src/ReportDefault.c 2010-03-30 18:57:17.000000000 -0400
++++ B/src/ReportDefault.c 2013-12-22 12:44:12.968001912 -0500
+@@ -76,20 +76,20 @@
+ stats->mFormat);
+
+ if ( stats->mUDP != (char)kMode_Server ) {
+ // TCP Reporting
+ if( !header_printed ) {
+- printf( report_bw_header);
++ printf( "%s", report_bw_header);
+ header_printed = 1;
+ }
+ printf( report_bw_format, stats->transferID,
+ stats->startTime, stats->endTime,
+ buffer, &buffer[sizeof(buffer)/2] );
+ } else {
+ // UDP Reporting
+ if( !header_printed ) {
+- printf( report_bw_jitter_loss_header);
++ printf( "%s", 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],
+@@ -157,11 +157,11 @@
+
+ win = getsock_tcp_windowsize( data->info.transferID,
+ (data->mThreadMode == kMode_Listener ? 0 : 1) );
+ win_requested = data->mTCPWin;
+
+- printf( separator_line );
++ printf( "%s", separator_line );
+ if ( data->mThreadMode == kMode_Listener ) {
+ printf( server_port,
+ (isUDP( data ) ? "UDP" : "TCP"),
+ data->mPort );
+ } else {
+@@ -196,11 +196,11 @@
+ byte_snprintf( buffer, sizeof(buffer), win_requested,
+ toupper( data->info.mFormat));
+ printf( warn_window_requested, buffer );
+ }
+ printf( "\n" );
+- printf( separator_line );
++ printf( "%s", separator_line );
+ }
+
+ /*
+ * Report a socket's peer IP address in default style
+ */
+@@ -284,11 +284,11 @@
+ net = "HIPPI";
+ mtu = 65280;
+ } else if ( checkMSS_MTU( inMSS, 576 ) ) {
+ net = "minimum";
+ mtu = 576;
+- printf( warn_no_pathmtu );
++ printf( "%s", warn_no_pathmtu );
+ } else {
+ mtu = inMSS + 40;
+ net = "unknown interface";
+ }
+
+diff -NarU5 A/src/Reporter.c B/src/Reporter.c
+--- A/src/Reporter.c 2010-03-30 19:08:24.000000000 -0400
++++ B/src/Reporter.c 2013-12-22 13:49:36.285733636 -0500
+@@ -894,11 +894,11 @@
+ net = "HIPPI";
+ mtu = 65280;
+ } else if ( checkMSS_MTU( inMSS, 576 ) ) {
+ net = "minimum";
+ mtu = 576;
+- printf( warn_no_pathmtu );
++ printf( "%s", warn_no_pathmtu );
+ } else {
+ mtu = inMSS + 40;
+ net = "unknown interface";
+ }
+
+diff -NarU5 A/src/Settings.cpp B/src/Settings.cpp
+--- A/src/Settings.cpp 2010-07-08 21:05:46.000000000 -0400
++++ B/src/Settings.cpp 2013-12-22 14:01:09.958686202 -0500
+@@ -373,12 +373,12 @@
+ case 'f': // format to print in
+ mExtSettings->mFormat = (*optarg);
+ break;
+
+ case 'h': // print help and exit
+- fprintf(stderr, usage_long1);
+- fprintf(stderr, usage_long2);
++ fprintf(stderr, "%s", usage_long1);
++ fprintf(stderr, "%s", usage_long2);
+ exit(1);
+ break;
+
+ case 'i': // specify interval between periodic bw reports
+ mExtSettings->mInterval = atof( optarg );
+@@ -480,11 +480,11 @@
+ fprintf( stderr, warn_implied_compatibility, option );
+ }
+ break;
+
+ case 'v': // print version and exit
+- fprintf( stderr, version );
++ fprintf( stderr, "%s", version );
+ exit(1);
+ break;
+
+ case 'w': // TCP window size (socket buffer size)
+ Settings_GetUpperCaseArg(optarg,outarg);
diff --git a/iperf.spec b/iperf.spec
index 891c27b..8d77f0a 100644
--- a/iperf.spec
+++ b/iperf.spec
@@ -1,6 +1,6 @@
Name: iperf
Version: 2.0.5
-Release: 9%{?dist}
+Release: 11%{?dist}
Summary: Measurement tool for TCP/UDP bandwidth performance
License: BSD
Group: Applications/Internet
@@ -8,6 +8,8 @@ URL: http://sourceforge.net/projects/iperf
Source: http://sourceforge.net/projects/iperf/files/%{name}-%{version}.tar.gz
Patch0: iperf-2.0.5-debuginfo.patch
Patch1: iperf-2.0.5-tcpdual.patch
+Patch2: iperf-2.0.5-format_security.patch
+Patch3: iperf-2.0.5-bind_fail.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf
@@ -20,6 +22,8 @@ jitter, datagram loss.
%setup -q
%patch0 -p1
%patch1 -p1
+%patch2 -p1
+%patch3 -p1
%build
%{__autoconf}
@@ -40,6 +44,12 @@ jitter, datagram loss.
%{_mandir}/man*/*
%changelog
+* Fri Jan 03 2014 Gabriel Somlo <somlo at cmu.edu> 2.0.5-11
+- patch to exit on port bind failure (#1047172, #1047569)
+
+* Sun Dec 22 2013 Gabriel Somlo <somlo at cmu.edu> 2.0.5-10
+- added patch to build with format security enabled (#1037132)
+
* Tue Aug 06 2013 Gabriel Somlo <somlo at cmu.edu> 2.0.5-9
- fix debuginfo regression (#925592)
More information about the scm-commits
mailing list