[netperf-dev] netperf2 commit notice r233 - trunk/src
raj at netperf.org
raj at netperf.org
Thu Feb 21 15:59:30 PST 2008
Author: raj
Date: 2008-02-21 15:59:30 -0800 (Thu, 21 Feb 2008)
New Revision: 233
Modified:
trunk/src/nettest_omni.c
Log:
implemented get_transport_info to make the mss output real
Modified: trunk/src/nettest_omni.c
===================================================================
--- trunk/src/nettest_omni.c 2008-02-21 01:52:00 UTC (rev 232)
+++ trunk/src/nettest_omni.c 2008-02-21 23:59:30 UTC (rev 233)
@@ -386,7 +386,7 @@
double remote_service_demand_double;
double transaction_rate = 1.0;
double rtt_latency = -1.0;
-int32_t transport_mss = -1;
+int32_t transport_mss = -2;
char *local_interface_name=NULL;
char *remote_interface_name=NULL;
char local_driver_name[32]="";
@@ -3416,6 +3416,44 @@
return 0;
}
+static void
+get_transport_info(SOCKET socket, int *mss, int protocol)
+{
+
+ netperf_socklen_t sock_opt_len;
+ int option;
+ sock_opt_len = sizeof(netperf_socklen_t);
+
+ switch (protocol) {
+#if defined(IPPROTO_TCP) && defined(TCP_MAXSEG)
+ case IPPROTO_TCP:
+ option = TCP_MAXSEG;
+ break;
+#endif
+
+#if defined(IPPROTO_SCTP) && defined(SCTP_MAXSEG)
+ case IPPROTO_SCTP:
+ option = SCTP_MAXSEG;
+ break;
+#endif
+ default:
+ *mss = -1;
+ return;
+ }
+
+ if (getsockopt(socket,
+ protocol,
+ option,
+ (char *)mss,
+ &sock_opt_len) == SOCKET_ERROR) {
+ fprintf(where,
+ "netperf: get_transport_info: getsockopt: errno %d\n",
+ errno);
+ fflush(where);
+ *mss = -1;
+ }
+}
+
/* this code is intended to be "the two routines to run them all" for
BSDish sockets. it comes about as part of a desire to shrink the
code footprint of netperf and to avoid having so many blessed
@@ -4062,7 +4100,7 @@
#endif
}
-
+
/* if this is a connection test, we want to do some stuff about
connection close here in the test loop. raj 2008-01-08 */
if (connection_test) {
@@ -4086,6 +4124,16 @@
lss_size_end = lss_size;
#endif
+ /* we will only make this call the one time - after the first
+ call, the value will be real or -1. if this is a connection
+ test we want to do this here because later we won't be
+ connected and the data may no longer be available */
+ if (transport_mss == -2)
+ get_transport_info(data_socket,
+ &transport_mss,
+ local_res->ai_protocol);
+
+
ret = disconnect_data_socket(data_socket,
(no_control) ? 1 : 0,
1,
@@ -4148,6 +4196,12 @@
/* we are now, ostensibly, at the end of this iteration */
+ if (transport_mss == -2)
+ get_transport_info(data_socket,
+ &transport_mss,
+ local_res->ai_protocol);
+
+
/* so, if we have/had a data connection, we will want to close it
now, and this will be independent of whether there is a control
connection. */
More information about the netperf-dev
mailing list