kProto_TCP = IPPROTO_TCP,
kProto_DCCP = IPPROTO_DCCP,
kProto_UDP = IPPROTO_UDP,
+ kProto_UDPLITE = IPPROTO_UDPLITE,
} Protocol;
static inline const char *protoName(const unsigned proto)
case kProto_TCP: return "TCP";
case kProto_DCCP: return "DCCP";
case kProto_UDP: return "UDP";
+ case kProto_UDPLITE: return "UDP-Lite";
default: return "(unknown)";
}
}
{
switch (p) {
case kProto_TCP: return SOCK_STREAM;
+ case kProto_UDPLITE: /* fall through */
case kProto_UDP: return SOCK_DGRAM;
case kProto_DCCP: return SOCK_DCCP;
}
static inline bool is_connectionless(const Protocol p)
{
- return p == kProto_UDP;
+ return p == kProto_UDP || p == kProto_UDPLITE;
}
// server/client mode
// chars
char mFormat; // -f
int mTTL; // -T
+ int cscov; // -u (partial csums)
char *congAlgo; // -A
char pad1[2];
// structs or miscellaneous
#ifndef SOL_DCCP
#define SOL_DCCP 269 /* include/linux/socket.h */
#endif
+
+/* UDP-Lite specific definitions and includes */
+#ifdef IPPROTO_UDPLITE
+#include <netinet/udplite.h>
+#else
+#define IPPROTO_UDPLITE 136
+#define SOL_UDPLITE 136
+
+#define UDPLITE_SEND_CSCOV 10
+#define UDPLITE_RECV_CSCOV 11
+#endif
#endif /* HEADERS_H */
-#define IPERF_VERSION "2.0.2 with support for DCCP and TCP CC"
+#define IPERF_VERSION "2.0.2 with support for DCCP, UDP-Lite, and TCP CC"
#define IPERF_VERSION_DATE "20th Jan 2009"
-l, --len #[KM] length of buffer to read or write (default 8 KB)\n\
-m, --print_mss print TCP maximum segment size (MTU - TCP/IP header)\n\
-p, --port # server port to listen on/connect to\n\
- -u, --udp use UDP as transport protocol\n\
- -d, --dccp use DCCP as transport protocol\n\
+ -u, --udp use UDP as transport; no argument may follow\n\
+ -u --udplite # use UDP-Lite as transport; arg: cscov (0=full coverage)\n\
+ -d, --dccp use DCCP as transport\n\
-w, --window #[KM] TCP window size (socket buffer size)\n\
-A, --algorithm set TCP congestion control algorithm\n\
-B, --bind <host> bind to <host>, an interface or multicast address\n\
-D, --daemon run the server as a daemon\n\
\n\
Client specific:\n\
- -b, --bandwidth #[KM] for UDP/DCCP, bandwidth to send at in bits/sec\n\
+ -b, --bandwidth #[KM] for UDP(-Lite)/DCCP, bandwidth to send at in bits/sec\n\
(default 1 Mbit/sec, implies -u)\n\
-c, --client <host> run in client mode, connecting to <host>\n\
-2, --dualtest Do a bidirectional test simultaneously\n\
&val, len );
WARN_errno( rc == SOCKET_ERROR, "setsockopt DCCP_SOCKOPT_SERVICE" );
}
+ // UDP-Lite specific options
+ if ( inSettings->mProtocol == kProto_UDPLITE ) {
+ /* we set the checksum coverage for both directions */
+ rc = setsockopt(inSettings->mSock, IPPROTO_UDPLITE, UDPLITE_SEND_CSCOV,
+ &inSettings->cscov, len);
+ WARN_errno(rc == SOCKET_ERROR, "setsockopt UDPLITE_SEND_CSCOV");
+
+ rc = setsockopt(inSettings->mSock, IPPROTO_UDPLITE, UDPLITE_RECV_CSCOV,
+ &inSettings->cscov, len);
+
+ WARN_errno(rc == SOCKET_ERROR, "setsockopt UDPLITE_RECV_CSCOV");
+ }
// reuse the address, so we can run if a former server was killed off
if (inSettings->mThreadMode == kMode_Listener) {
{"server", no_argument, NULL, 's'},
{"time", required_argument, NULL, 't'},
{"udp", no_argument, NULL, 'u'},
+{"udplite", required_argument, NULL, 'u'},
{"version", no_argument, NULL, 'v'},
{"window", required_argument, NULL, 'w'},
{"reportexclude", required_argument, NULL, 'x'},
#define SHORT_OPTIONS()
const char short_options[] =
- "12b::c:df:hi:j:l:mn:o:p:rst:uvw:x:y:A:B:CDF:IJ:L:M:NP:RS:T:UV:W";
+ "12b::c:df:hi:j:l:mn:o:p:rst:u::vw:x:y:A:B:CDF:IJ:L:M:NP:RS:T:UV:W";
/* -------------------------------------------------------------------
* defaults
mExtSettings->mAmount = (int) (atof( optarg ) * 100.0);
break;
- case 'u': // UDP instead of TCP
- mExtSettings->mProtocol = kProto_UDP;
+ case 'u': // UDP(-Lite) instead of TCP
+ if (optarg) {
+ mExtSettings->mProtocol = kProto_UDPLITE;
+ // Set partial checksum coverage:
+ // - 0 means entire datagram,
+ // - 1..7 is illegal and will be rounded up to 8;
+ // - 8 and greater mean genuine partial coverage.
+ mExtSettings->cscov = atoi(optarg);
+ } else
+ mExtSettings->mProtocol = kProto_UDP;
setPacketOriented(mExtSettings);
// if -b has already been processed, UDP rate will
if (isPacketOriented(ext_gSettings) &&
!(ext_gSettings->mProtocol == kProto_UDP ||
+ ext_gSettings->mProtocol == kProto_UDPLITE ||
ext_gSettings->mProtocol == kProto_DCCP ))
die("Can't use packet-oriented mode with these settings.");