Merge branch 'datagram_packing' into message_reordering

This commit is contained in:
Hanno Becker 2018-08-24 12:16:41 +01:00
commit 0e96585bdd
6 changed files with 101 additions and 39 deletions

View file

@ -147,6 +147,20 @@ static int ssl_get_remaining_payload_in_datagram( mbedtls_ssl_context const *ssl
if( max_len > mfl )
max_len = mfl;
/* By the standard (RFC 6066 Sect. 4), the MFL extension
* only limits the maximum record payload size, so in theory
* we would be allowed to pack multiple records of payload size
* MFL into a single datagram. However, this would mean that there's
* no way to explicitly communicate MTU restrictions to the peer.
*
* The following reduction of max_len makes sure that we never
* write datagrams larger than MFL + Record Expansion Overhead.
*/
if( max_len <= ssl->out_left )
return( 0 );
max_len -= ssl->out_left;
#endif
ret = ssl_get_remaining_space_in_datagram( ssl );
@ -6976,8 +6990,8 @@ void mbedtls_ssl_conf_dtls_badmac_limit( mbedtls_ssl_config *conf, unsigned limi
#if defined(MBEDTLS_SSL_PROTO_DTLS)
void mbedtls_ssl_conf_datagram_packing( mbedtls_ssl_context *ssl,
unsigned allow_packing )
void mbedtls_ssl_set_datagram_packing( mbedtls_ssl_context *ssl,
unsigned allow_packing )
{
ssl->disable_datagram_packing = !allow_packing;
}