The maximum send length for UDP is the maximum size of a UDP datagram.
For UDP over IPv4, this is the maximum IPv4 packet size (65535) minus the size of the IPv4 and UDP headers, arriving at 65507. In theory for a system implementing IPv6 jumbogram support, there is no maximum packet size for UDP. In practice we've observed with CentOS 5 a limitation of 65535 - 8, which is dictated by the size field in the UDP header (it has a maximum value of 65535, but needs to count both payload and header bytes, thus subtracting off the 8 bytes for the UDP header). We take the most conservative approach and use the 65507 value for UDP / IPv4. This is (I believe) the last part of issue #212.
This commit is contained in:
parent
8694d1db0d
commit
96d0c77ca2
@ -291,6 +291,8 @@ struct iperf_test
|
|||||||
#define MB (1024 * 1024)
|
#define MB (1024 * 1024)
|
||||||
#define MAX_TCP_BUFFER (512 * MB)
|
#define MAX_TCP_BUFFER (512 * MB)
|
||||||
#define MAX_BLOCKSIZE MB
|
#define MAX_BLOCKSIZE MB
|
||||||
|
/* Maximum size UDP send is (64K - 1) - IP and UDP header sizes */
|
||||||
|
#define MAX_UDP_BLOCKSIZE (65535 - 8 - 20)
|
||||||
#define MIN_INTERVAL 0.1
|
#define MIN_INTERVAL 0.1
|
||||||
#define MAX_INTERVAL 60.0
|
#define MAX_INTERVAL 60.0
|
||||||
#define MAX_TIME 86400
|
#define MAX_TIME 86400
|
||||||
|
@ -913,6 +913,11 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
|||||||
i_errno = IEBLOCKSIZE;
|
i_errno = IEBLOCKSIZE;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (test->protocol->id == Pudp &&
|
||||||
|
blksize > MAX_UDP_BLOCKSIZE) {
|
||||||
|
i_errno = IEUDPBLOCKSIZE;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
test->settings->blksize = blksize;
|
test->settings->blksize = blksize;
|
||||||
|
|
||||||
if (!rate_flag)
|
if (!rate_flag)
|
||||||
|
@ -281,6 +281,7 @@ enum {
|
|||||||
IELOGFILE = 17, // Can't open log file
|
IELOGFILE = 17, // Can't open log file
|
||||||
IENOSCTP = 18, // No SCTP support available
|
IENOSCTP = 18, // No SCTP support available
|
||||||
IEBIND = 19, // Local port specified with no local bind option
|
IEBIND = 19, // Local port specified with no local bind option
|
||||||
|
IEUDPBLOCKSIZE = 20, // Block size too large. Maximum value = %dMAX_UDP_BLOCKSIZE
|
||||||
/* Test errors */
|
/* Test errors */
|
||||||
IENEWTEST = 100, // Unable to create a new test (check perror)
|
IENEWTEST = 100, // Unable to create a new test (check perror)
|
||||||
IEINITTEST = 101, // Test initialization failed (check perror)
|
IEINITTEST = 101, // Test initialization failed (check perror)
|
||||||
|
@ -124,6 +124,9 @@ iperf_strerror(int i_errno)
|
|||||||
case IEBIND:
|
case IEBIND:
|
||||||
snprintf(errstr, len, "--bind must be specified to use --cport");
|
snprintf(errstr, len, "--bind must be specified to use --cport");
|
||||||
break;
|
break;
|
||||||
|
case IEUDPBLOCKSIZE:
|
||||||
|
snprintf(errstr, len, "block size too large (maximum = %d bytes)", MAX_UDP_BLOCKSIZE);
|
||||||
|
break;
|
||||||
case IEMSS:
|
case IEMSS:
|
||||||
snprintf(errstr, len, "TCP MSS too large (maximum = %d bytes)", MAX_MSS);
|
snprintf(errstr, len, "TCP MSS too large (maximum = %d bytes)", MAX_MSS);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user