Merged print mss (-m) into verbose mode (-V)

This commit is contained in:
sethdelliott 2010-08-04 19:19:08 +00:00
parent 9a599d5f8d
commit 02a35f07e3
5 changed files with 12 additions and 24 deletions

View File

@ -30,9 +30,6 @@ set server port to listen on/connect to to \fIn\fR (default 5201)
.BR -i ", " --interval " \fIn\fR" .BR -i ", " --interval " \fIn\fR"
pause \fIn\fR seconds between periodic bandwidth reports pause \fIn\fR seconds between periodic bandwidth reports
.TP .TP
.BR -m ", " --print_mss " "
print TCP maximum segment size (MTU - TCP/IP header)
.TP
.BR -h ", " --help " " .BR -h ", " --help " "
print a help synopsis print a help synopsis
.TP .TP

View File

@ -131,7 +131,6 @@ struct iperf_test
int debug; /* -d option - debug mode */ int debug; /* -d option - debug mode */
int no_delay; /* -N option */ int no_delay; /* -N option */
int output_format; /* -O option */ int output_format; /* -O option */
int print_mss; /* -m option */
int reverse; /* -R option */ int reverse; /* -R option */
int tcp_info; /* -T option - display getsockopt(TCP_INFO) results. */ int tcp_info; /* -T option - display getsockopt(TCP_INFO) results. */
int v6domain; /* -6 option */ int v6domain; /* -6 option */

View File

@ -124,7 +124,7 @@ iperf_on_connect(struct iperf_test *test)
char ipr[INET6_ADDRSTRLEN]; char ipr[INET6_ADDRSTRLEN];
struct sockaddr_storage temp; struct sockaddr_storage temp;
socklen_t len; socklen_t len;
int domain; int domain, opt;
if (test->role == 'c') { if (test->role == 'c') {
printf("Connecting to host %s, port %d\n", test->server_hostname, printf("Connecting to host %s, port %d\n", test->server_hostname,
@ -143,6 +143,15 @@ iperf_on_connect(struct iperf_test *test)
} }
if (test->verbose) { if (test->verbose) {
printf(" Cookie: %s\n", test->cookie); printf(" Cookie: %s\n", test->cookie);
if (test->protocol->id == SOCK_STREAM) {
if (test->settings->mss) {
printf(" TCP MSS: %d\n", test->settings->mss);
} else {
len = sizeof(opt);
getsockopt(test->ctrl_sck, IPPROTO_TCP, TCP_MAXSEG, &opt, &len);
printf(" TCP MSS: %d (default)\n", opt);
}
}
} }
} }
@ -177,7 +186,6 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
{"interval", required_argument, NULL, 'i'}, {"interval", required_argument, NULL, 'i'},
{"bytes", required_argument, NULL, 'n'}, {"bytes", required_argument, NULL, 'n'},
{"NoDelay", no_argument, NULL, 'N'}, {"NoDelay", no_argument, NULL, 'N'},
{"Print-mss", no_argument, NULL, 'm'},
{"Set-mss", required_argument, NULL, 'M'}, {"Set-mss", required_argument, NULL, 'M'},
{"version", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'v'},
{"verbose", no_argument, NULL, 'V'}, {"verbose", no_argument, NULL, 'V'},
@ -199,7 +207,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
}; };
char ch; char ch;
while ((ch = getopt_long(argc, argv, "c:p:st:uP:B:b:l:w:i:n:mRS:NTvh6VdM:f:", longopts, NULL)) != -1) { while ((ch = getopt_long(argc, argv, "c:p:st:uP:B:b:l:w:i:n:RS:NTvh6VdM:f:", longopts, NULL)) != -1) {
switch (ch) { switch (ch) {
case 'c': case 'c':
if (test->role == 's') { if (test->role == 's') {
@ -303,9 +311,6 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
} }
test->settings->bytes = unit_atoi(optarg); test->settings->bytes = unit_atoi(optarg);
break; break;
case 'm':
test->print_mss = 1;
break;
case 'N': case 'N':
if (test->role == 's') { if (test->role == 's') {
i_errno = IECLIENTONLY; i_errno = IECLIENTONLY;
@ -830,7 +835,6 @@ parse_results(struct iperf_test *test, char *results)
for (strp = results; *strp; strp = strchr(strp, '\n')+1) { for (strp = results; *strp; strp = strchr(strp, '\n')+1) {
sscanf(strp, "%d:%llu,%lf,%d,%d\n", &sid, &bytes_transferred, &jitter, sscanf(strp, "%d:%llu,%lf,%d,%d\n", &sid, &bytes_transferred, &jitter,
&cerror, &pcount); &cerror, &pcount);
// for (sp = test->streams; sp; sp = sp->next)
SLIST_FOREACH(sp, &test->streams, streams) SLIST_FOREACH(sp, &test->streams, streams)
if (sp->id == sid) break; if (sp->id == sid) break;
if (sp == NULL) { if (sp == NULL) {
@ -1146,7 +1150,6 @@ iperf_reporter_callback(struct iperf_test * test)
case TEST_RUNNING: case TEST_RUNNING:
case STREAM_RUNNING: case STREAM_RUNNING:
/* print interval results for each stream */ /* print interval results for each stream */
// for (sp = test->streams; sp != NULL; sp = sp->next) {
SLIST_FOREACH(sp, &test->streams, streams) { SLIST_FOREACH(sp, &test->streams, streams) {
print_interval_results(test, sp); print_interval_results(test, sp);
bytes += sp->result->interval_results->bytes_transferred; /* sum up all streams */ bytes += sp->result->interval_results->bytes_transferred; /* sum up all streams */
@ -1182,7 +1185,6 @@ iperf_reporter_callback(struct iperf_test * test)
start_time = 0.; start_time = 0.;
sp = SLIST_FIRST(&test->streams); sp = SLIST_FIRST(&test->streams);
end_time = timeval_diff(&sp->result->start_time, &sp->result->end_time); end_time = timeval_diff(&sp->result->start_time, &sp->result->end_time);
// for (sp = test->streams; sp != NULL; sp = sp->next) {
SLIST_FOREACH(sp, &test->streams, streams) { SLIST_FOREACH(sp, &test->streams, streams) {
bytes_sent = sp->result->bytes_sent; bytes_sent = sp->result->bytes_sent;
bytes_received = sp->result->bytes_received; bytes_received = sp->result->bytes_received;
@ -1244,11 +1246,6 @@ iperf_reporter_callback(struct iperf_test * test)
printf(report_sum_bw_jitter_loss_format, start_time, end_time, ubuf, nbuf, avg_jitter, printf(report_sum_bw_jitter_loss_format, start_time, end_time, ubuf, nbuf, avg_jitter,
lost_packets, total_packets, (double) (100.0 * lost_packets / total_packets)); lost_packets, total_packets, (double) (100.0 * lost_packets / total_packets));
} }
// XXX: Why is this here?
if ((test->print_mss != 0) && (test->role == 'c')) {
printf("The TCP maximum segment size mss = %d\n", getsock_tcp_mss(sp->socket));
}
} }
break; break;
} }

View File

@ -391,10 +391,7 @@ iperf_run_server(struct iperf_test *test)
} }
} }
/* Clean up the last test */ /* Close open test sockets */
//iperf_test_reset(test);
//printf("\n");
close(test->ctrl_sck); close(test->ctrl_sck);
close(test->listener); close(test->listener);

View File

@ -132,7 +132,6 @@ iperf_tcp_listen(struct iperf_test *test)
i_errno = IESETNODELAY; i_errno = IESETNODELAY;
return (-1); return (-1);
} }
printf(" TCP NODELAY: on\n");
} }
// XXX: Setting MSS is very buggy! // XXX: Setting MSS is very buggy!
if ((opt = test->settings->mss)) { if ((opt = test->settings->mss)) {
@ -140,7 +139,6 @@ iperf_tcp_listen(struct iperf_test *test)
i_errno = IESETMSS; i_errno = IESETMSS;
return (-1); return (-1);
} }
printf(" TCP MSS: %d\n", opt);
} }
if ((opt = test->settings->socket_bufsize)) { if ((opt = test->settings->socket_bufsize)) {
if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &opt, sizeof(opt)) < 0) { if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &opt, sizeof(opt)) < 0) {