aboutsummaryrefslogtreecommitdiff
path: root/src/iperf_api.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_api.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_api.c')
-rw-r--r--src/iperf_api.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/iperf_api.c b/src/iperf_api.c
index 068930f..435f032 100644
--- a/src/iperf_api.c
+++ b/src/iperf_api.c
@@ -584,6 +584,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
{"reverse", no_argument, NULL, 'R'},
{"window", required_argument, NULL, 'w'},
{"bind", required_argument, NULL, 'B'},
+ {"cport", required_argument, NULL, 'e'},
{"set-mss", required_argument, NULL, 'M'},
{"no-delay", no_argument, NULL, 'N'},
{"version4", no_argument, NULL, '4'},
@@ -624,7 +625,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
blksize = 0;
server_flag = client_flag = rate_flag = duration_flag = 0;
- while ((flag = getopt_long(argc, argv, "p:f:i:DVJvsc:ub:t:n:k:l:P:Rw:B:M:N46S:L:ZO:F:A:T:C:dI:h", longopts, NULL)) != -1) {
+ while ((flag = getopt_long(argc, argv, "p:f:i:DVJvsc:ub:t:n:k:l:P:Rw:B:e:M:N46S:L:ZO:F:A:T:C:dI:h", longopts, NULL)) != -1) {
switch (flag) {
case 'p':
test->server_port = atoi(optarg);
@@ -745,6 +746,9 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
case 'B':
test->bind_address = strdup(optarg);
break;
+ case 'e':
+ test->bind_port = atoi(optarg);
+ break;
case 'M':
test->settings->mss = atoi(optarg);
if (test->settings->mss > MAX_MSS) {
@@ -876,6 +880,10 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
return -1;
}
+ if (!test->bind_address && test->bind_port) {
+ i_errno = IEBIND;
+ return -1;
+ }
if (blksize == 0) {
if (test->protocol->id == Pudp)
blksize = DEFAULT_UDP_BLKSIZE;