Retrieve tcpi_retrans from struct tcpinfo and put it in the JSON.
This change is for experimentation, and for evaluating how useful
having that variable is.
diff --git a/src/iperf.h b/src/iperf.h
index efa7da5..6b757eb 100755
--- a/src/iperf.h
+++ b/src/iperf.h
@@ -83,6 +83,7 @@
     int rtt;
     int rttvar;
     int pmtu;
+    int retrans;		/* tcpi_retrans */
 };
 
 struct iperf_stream_result
diff --git a/src/iperf_api.c b/src/iperf_api.c
index d52a38f..6e3b27b 100755
--- a/src/iperf_api.c
+++ b/src/iperf_api.c
@@ -2409,6 +2409,7 @@
 		    temp.rttvar = get_rttvar(&temp);
 		    temp.pmtu = get_pmtu(&temp);
 		    temp.rcv_space = get_rcv_space(&temp);
+		    temp.retrans = get_retrans(&temp);
 		}
 	    }
 	} else {
@@ -3034,7 +3035,7 @@
 	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  rcv_space: %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->rcv_space, (int64_t) irp->rtt, (int64_t) irp->rttvar, (int64_t) irp->pmtu, 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  rcv_space: %d  rtt:  %d  rttvar: %d  pmtu: %d  tcpi_retrans: %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->rcv_space, (int64_t) irp->rtt, (int64_t) irp->rttvar, (int64_t) irp->pmtu, (int64_t) irp->retrans, 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 8f26fbc..5575f76 100755
--- a/src/iperf_api.h
+++ b/src/iperf_api.h
@@ -216,6 +216,7 @@
 long get_rtt(struct iperf_interval_results *irp);
 long get_rttvar(struct iperf_interval_results *irp);
 long get_pmtu(struct iperf_interval_results *irp);
+long get_retrans(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 8211301..1c4f696 100644
--- a/src/tcp_info.c
+++ b/src/tcp_info.c
@@ -199,6 +199,20 @@
 
 /*************************************************************/
 /*
+ * Return tcpi_retrans
+ */
+long
+get_retrans(struct iperf_interval_results *irp)
+{
+#if defined(linux) && defined(TCP_MD5SIG)
+    return irp->tcpInfo.tcpi_retrans;
+#else
+    return -1;
+#endif
+}
+
+/*************************************************************/
+/*
  * Return PMTU in bytes.
  */
 long