aboutsummaryrefslogtreecommitdiff
path: root/src/iperf_tcp.c
diff options
context:
space:
mode:
authorKevin Constantine <kevin.constantine@disneyanimation.com>2014-09-09 16:31:57 -0700
committerKevin Constantine <kevin.constantine@disneyanimation.com>2014-09-09 16:31:57 -0700
commitb7b1b32afe949b2180bd54f280dbe0199a1dfaab (patch)
treefa0def97184e0cd53899f280180a0decf7821043 /src/iperf_tcp.c
parentbd9e3ae5bfe9594da8f0b7b76b4c73f6cb8d2381 (diff)
downloadiperf3-b7b1b32afe949b2180bd54f280dbe0199a1dfaab.tar.gz
Add support for specifying client-side epemeral port
-e/--cport now allows a user to specify the client-side port used for data transfer. Signed-off-by: Kevin Constantine <kevin.constantine@gmail.com>
Diffstat (limited to 'src/iperf_tcp.c')
-rw-r--r--src/iperf_tcp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/iperf_tcp.c b/src/iperf_tcp.c
index cdf4cd2..0324e44 100644
--- a/src/iperf_tcp.c
+++ b/src/iperf_tcp.c
@@ -325,6 +325,11 @@ iperf_tcp_connect(struct iperf_test *test)
}
if (test->bind_address) {
+ struct sockaddr_in *lcladdr;
+ lcladdr = (struct sockaddr_in *)local_res->ai_addr;
+ lcladdr->sin_port = htons(test->bind_port);
+ local_res->ai_addr = (struct sockaddr *)lcladdr;
+
if (bind(s, (struct sockaddr *) local_res->ai_addr, local_res->ai_addrlen) < 0) {
saved_errno = errno;
close(s);