From 6bd4e258d0440e036e8780528e2d5aacdaaba6b2 Mon Sep 17 00:00:00 2001 From: "Bruce A. Mah" Date: Wed, 14 Jan 2015 08:40:26 -0800 Subject: [PATCH] Make the combination of -B and -P but not --cport work The case where we should have been binding the client sockets to ephemeral ports at a specific address for parallel tests was broken. Fixes #239 Submitted by: @jfitzgibbon --- src/iperf_client_api.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c index 865faa1..7e8bea6 100644 --- a/src/iperf_client_api.c +++ b/src/iperf_client_api.c @@ -1,5 +1,5 @@ /* - * iperf, Copyright (c) 2014, The Regents of the University of + * iperf, Copyright (c) 2014, 2015, The Regents of the University of * California, through Lawrence Berkeley National Laboratory (subject * to receipt of any required approvals from the U.S. Dept. of * Energy). All rights reserved. @@ -53,7 +53,9 @@ iperf_create_streams(struct iperf_test *test) int orig_bind_port = test->bind_port; for (i = 0; i < test->num_streams; ++i) { - test->bind_port = orig_bind_port + i; + test->bind_port = orig_bind_port; + if (orig_bind_port) + test->bind_port += i; if ((s = test->protocol->connect(test)) < 0) return -1;