|
version 1.1, 2016/10/18 13:28:18
|
version 1.1.1.2, 2021/03/17 00:36:46
|
|
Line 1
|
Line 1
|
| /* |
/* |
| * 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 |
* California, through Lawrence Berkeley National Laboratory (subject |
| * to receipt of any required approvals from the U.S. Dept. of |
* to receipt of any required approvals from the U.S. Dept. of |
| * Energy). All rights reserved. |
* Energy). All rights reserved. |
|
Line 48
|
Line 48
|
| #include <sys/param.h> |
#include <sys/param.h> |
| #include <sys/types.h> |
#include <sys/types.h> |
| #include <sys/socket.h> |
#include <sys/socket.h> |
| #include <netinet/tcp.h> |
|
| #include <string.h> |
#include <string.h> |
| #include <netinet/in.h> |
#include <netinet/in.h> |
| #include <errno.h> |
#include <errno.h> |
|
Line 136 get_snd_cwnd(struct iperf_interval_results *irp)
|
Line 135 get_snd_cwnd(struct iperf_interval_results *irp)
|
| #if defined(linux) && defined(TCP_MD5SIG) |
#if defined(linux) && defined(TCP_MD5SIG) |
| return irp->tcpInfo.tcpi_snd_cwnd * irp->tcpInfo.tcpi_snd_mss; |
return irp->tcpInfo.tcpi_snd_cwnd * irp->tcpInfo.tcpi_snd_mss; |
| #elif defined(__FreeBSD__) && __FreeBSD_version >= 600000 |
#elif defined(__FreeBSD__) && __FreeBSD_version >= 600000 |
| return irp->tcpInfo.tcpi_snd_cwnd * irp->tcpInfo.tcpi_snd_mss; | return irp->tcpInfo.tcpi_snd_cwnd; |
| #elif defined(__NetBSD__) && defined(TCP_INFO) |
#elif defined(__NetBSD__) && defined(TCP_INFO) |
| return irp->tcpInfo.tcpi_snd_cwnd * irp->tcpInfo.tcpi_snd_mss; |
return irp->tcpInfo.tcpi_snd_cwnd * irp->tcpInfo.tcpi_snd_mss; |
| #else |
#else |
|
Line 163 get_rtt(struct iperf_interval_results *irp)
|
Line 162 get_rtt(struct iperf_interval_results *irp)
|
| } |
} |
| |
|
| /*************************************************************/ |
/*************************************************************/ |
| |
/* |
| |
* Return rttvar in usec. |
| |
*/ |
| |
long |
| |
get_rttvar(struct iperf_interval_results *irp) |
| |
{ |
| |
#if defined(linux) && defined(TCP_MD5SIG) |
| |
return irp->tcpInfo.tcpi_rttvar; |
| |
#elif defined(__FreeBSD__) && __FreeBSD_version >= 600000 |
| |
return irp->tcpInfo.tcpi_rttvar; |
| |
#elif defined(__NetBSD__) && defined(TCP_INFO) |
| |
return irp->tcpInfo.tcpi_rttvar; |
| |
#else |
| |
return -1; |
| |
#endif |
| |
} |
| |
|
| |
/*************************************************************/ |
| |
/* |
| |
* 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 |
void |
| build_tcpinfo_message(struct iperf_interval_results *r, char *message) |
build_tcpinfo_message(struct iperf_interval_results *r, char *message) |
| { |
{ |
| #if defined(linux) | #if defined(linux) && defined(TCP_INFO) |
| sprintf(message, report_tcpInfo, r->tcpInfo.tcpi_snd_cwnd, r->tcpInfo.tcpi_snd_ssthresh, |
sprintf(message, report_tcpInfo, r->tcpInfo.tcpi_snd_cwnd, r->tcpInfo.tcpi_snd_ssthresh, |
| r->tcpInfo.tcpi_rcv_ssthresh, r->tcpInfo.tcpi_unacked, r->tcpInfo.tcpi_sacked, |
r->tcpInfo.tcpi_rcv_ssthresh, r->tcpInfo.tcpi_unacked, r->tcpInfo.tcpi_sacked, |
| r->tcpInfo.tcpi_lost, r->tcpInfo.tcpi_retrans, r->tcpInfo.tcpi_fackets, |
r->tcpInfo.tcpi_lost, r->tcpInfo.tcpi_retrans, r->tcpInfo.tcpi_fackets, |
| r->tcpInfo.tcpi_rtt, r->tcpInfo.tcpi_reordering); |
r->tcpInfo.tcpi_rtt, r->tcpInfo.tcpi_reordering); |
| #endif |
#endif |
| #if defined(__FreeBSD__) | #if defined(__FreeBSD__) && defined(TCP_INFO) |
| sprintf(message, report_tcpInfo, r->tcpInfo.tcpi_snd_cwnd, |
sprintf(message, report_tcpInfo, r->tcpInfo.tcpi_snd_cwnd, |
| r->tcpInfo.tcpi_rcv_space, r->tcpInfo.tcpi_snd_ssthresh, r->tcpInfo.tcpi_rtt); |
r->tcpInfo.tcpi_rcv_space, r->tcpInfo.tcpi_snd_ssthresh, r->tcpInfo.tcpi_rtt); |
| #endif |
#endif |