aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce A. Mah <bmah@kitchenlab.org>2017-05-12 13:42:50 -0700
committerGitHub <noreply@github.com>2017-05-12 13:42:50 -0700
commit52375c105aba940a7e90f98344f5f7a2011b9bed (patch)
tree45ae2887f449bdb1598fc5f1454addb7e5f6147c /src
parentd54d49c0ac4693108f60f73a9e9c0e1c7cf24456 (diff)
downloadiperf3-52375c105aba940a7e90f98344f5f7a2011b9bed.tar.gz
Grab TCP PMTU during tests (on Linux only). Towards #569. (#578)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/iperf.h1
-rwxr-xr-xsrc/iperf_api.c3
-rwxr-xr-xsrc/iperf_api.h1
-rw-r--r--src/tcp_info.c16
4 files changed, 19 insertions, 2 deletions
diff --git a/src/iperf.h b/src/iperf.h
index ebb90f0..53c44d2 100755
--- a/src/iperf.h
+++ b/src/iperf.h
@@ -81,6 +81,7 @@ struct iperf_interval_results
void *custom_data;
int rtt;
int rttvar;
+ int pmtu;
};
struct iperf_stream_result
diff --git a/src/iperf_api.c b/src/iperf_api.c
index 62e4942..f33e720 100755
--- a/src/iperf_api.c
+++ b/src/iperf_api.c
@@ -2407,6 +2407,7 @@ iperf_stats_callback(struct iperf_test *test)
rp->stream_count_rtt++;
temp.rttvar = get_rttvar(&temp);
+ temp.pmtu = get_pmtu(&temp);
}
}
} else {
@@ -3032,7 +3033,7 @@ print_interval_results(struct iperf_test *test, struct iperf_stream *sp, cJSON *
if (test->sender && test->sender_has_retransmits) {
/* Interval, TCP with retransmits. */
if (test->json_output)
- cJSON_AddItemToArray(json_interval_streams, iperf_json_printf("socket: %d start: %f end: %f seconds: %f bytes: %d bits_per_second: %f retransmits: %d snd_cwnd: %d rtt: %d rttvar: %d omitted: %b", (int64_t) sp->socket, (double) st, (double) et, (double) irp->interval_duration, (int64_t) irp->bytes_transferred, bandwidth * 8, (int64_t) irp->interval_retrans, (int64_t) irp->snd_cwnd, (int64_t) irp->rtt, (int64_t) irp->rttvar, irp->omitted));
+ cJSON_AddItemToArray(json_interval_streams, iperf_json_printf("socket: %d start: %f end: %f seconds: %f bytes: %d bits_per_second: %f retransmits: %d snd_cwnd: %d rtt: %d rttvar: %d pmtu: %d omitted: %b", (int64_t) sp->socket, (double) st, (double) et, (double) irp->interval_duration, (int64_t) irp->bytes_transferred, bandwidth * 8, (int64_t) irp->interval_retrans, (int64_t) irp->snd_cwnd, (int64_t) irp->rtt, (int64_t) irp->rttvar, (int64_t) irp->pmtu, irp->omitted));
else {
unit_snprintf(cbuf, UNIT_LEN, irp->snd_cwnd, 'A');
iperf_printf(test, report_bw_retrans_cwnd_format, sp->socket, st, et, ubuf, nbuf, irp->interval_retrans, cbuf, irp->omitted?report_omitted:"");
diff --git a/src/iperf_api.h b/src/iperf_api.h
index 87fbab8..e1f3137 100755
--- a/src/iperf_api.h
+++ b/src/iperf_api.h
@@ -214,6 +214,7 @@ long get_total_retransmits(struct iperf_interval_results *irp);
long get_snd_cwnd(struct iperf_interval_results *irp);
long get_rtt(struct iperf_interval_results *irp);
long get_rttvar(struct iperf_interval_results *irp);
+long get_pmtu(struct iperf_interval_results *irp);
void print_tcpinfo(struct iperf_test *test);
void build_tcpinfo_message(struct iperf_interval_results *r, char *message);
diff --git a/src/tcp_info.c b/src/tcp_info.c
index e4cecbd..bfbb9ea 100644
--- a/src/tcp_info.c
+++ b/src/tcp_info.c
@@ -1,5 +1,5 @@
/*
- * iperf, Copyright (c) 2014, The Regents of the University of
+ * iperf, Copyright (c) 2014, 2017, 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.
@@ -180,6 +180,20 @@ get_rttvar(struct iperf_interval_results *irp)
}
/*************************************************************/
+/*
+ * Return PMTU in bytes.
+ */
+long
+get_pmtu(struct iperf_interval_results *irp)
+{
+#if defined(linux) && defined(TCP_MD5SIG)
+ return irp->tcpInfo.tcpi_pmtu;
+#else
+ return -1;
+#endif
+}
+
+/*************************************************************/
void
build_tcpinfo_message(struct iperf_interval_results *r, char *message)
{