mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 10:38:41 +00:00
Add cmd line option to ssl_client2 for datagram packing
This commit adds a new command line option `dgram_packing` to the example server application programs/ssl/ssl_client2 allowing to allow/forbid the use of datagram packing.
This commit is contained in:
parent
e7675d0d3d
commit
4d61591c0c
1 changed files with 19 additions and 1 deletions
|
@ -107,6 +107,7 @@ int main( void )
|
|||
#define DFL_HS_TO_MIN 0
|
||||
#define DFL_HS_TO_MAX 0
|
||||
#define DFL_DTLS_MTU -1
|
||||
#define DFL_DGRAM_PACKING 1
|
||||
#define DFL_FALLBACK -1
|
||||
#define DFL_EXTENDED_MS -1
|
||||
#define DFL_ETM -1
|
||||
|
@ -200,7 +201,10 @@ int main( void )
|
|||
" dtls=%%d default: 0 (TLS)\n" \
|
||||
" hs_timeout=%%d-%%d default: (library default: 1000-60000)\n" \
|
||||
" range of DTLS handshake timeouts in millisecs\n" \
|
||||
" mtu=%%d default: (library default: unlimited)\n"
|
||||
" mtu=%%d default: (library default: unlimited)\n" \
|
||||
" dgram_packing=%%d default: 1 (allowed)\n" \
|
||||
" allow or forbid packing of multiple\n" \
|
||||
" records within a single datgram.\n"
|
||||
#else
|
||||
#define USAGE_DTLS ""
|
||||
#endif
|
||||
|
@ -349,6 +353,7 @@ struct options
|
|||
uint32_t hs_to_max; /* Max value of DTLS handshake timer */
|
||||
int dtls_mtu; /* UDP Maximum tranport unit for DTLS */
|
||||
int fallback; /* is this a fallback connection? */
|
||||
int dgram_packing; /* allow/forbid datagram packing */
|
||||
int extended_ms; /* negotiate extended master secret? */
|
||||
int etm; /* negotiate encrypt then mac? */
|
||||
} opt;
|
||||
|
@ -624,6 +629,7 @@ int main( int argc, char *argv[] )
|
|||
opt.fallback = DFL_FALLBACK;
|
||||
opt.extended_ms = DFL_EXTENDED_MS;
|
||||
opt.etm = DFL_ETM;
|
||||
opt.dgram_packing = DFL_DGRAM_PACKING;
|
||||
|
||||
for( i = 1; i < argc; i++ )
|
||||
{
|
||||
|
@ -937,6 +943,15 @@ int main( int argc, char *argv[] )
|
|||
if( opt.dtls_mtu < 0 )
|
||||
goto usage;
|
||||
}
|
||||
else if( strcmp( p, "dgram_packing" ) == 0 )
|
||||
{
|
||||
opt.dgram_packing = atoi( q );
|
||||
if( opt.dgram_packing != 0 &&
|
||||
opt.dgram_packing != 1 )
|
||||
{
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
else if( strcmp( p, "recsplit" ) == 0 )
|
||||
{
|
||||
opt.recsplit = atoi( q );
|
||||
|
@ -1340,6 +1355,9 @@ int main( int argc, char *argv[] )
|
|||
|
||||
if( opt.dtls_mtu != DFL_DTLS_MTU )
|
||||
mbedtls_ssl_conf_mtu( &conf, opt.dtls_mtu );
|
||||
|
||||
if( opt.dgram_packing != DFL_DGRAM_PACKING )
|
||||
mbedtls_ssl_conf_datagram_packing( &ssl, opt.dgram_packing );
|
||||
#endif /* MBEDTLS_SSL_PROTO_DTLS */
|
||||
|
||||
#if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
|
||||
|
|
Loading…
Reference in a new issue