DTLS rx size check, ssn10

Allows for receiving datagrams larger than the MTU that are reassembled
by the IP stack.
This commit is contained in:
John Safranek
2013-05-17 10:29:34 -07:00
parent fd5937b599
commit b347df8d9a
3 changed files with 19 additions and 4 deletions

View File

@@ -88,6 +88,15 @@
#endif /* min */
#ifndef max
static INLINE word32 max(word32 a, word32 b)
{
return a > b ? a : b;
}
#endif /* min */
#ifndef CYASSL_LEANPSK
char* mystrnstr(const char* s1, const char* s2, unsigned int n)
@@ -440,6 +449,10 @@ static int CyaSSL_read_internal(CYASSL* ssl, void* data, int sz, int peek)
#ifdef HAVE_ERRNO_H
errno = 0;
#endif
#ifdef CYASSL_DTLS
if (ssl->options.dtls)
ssl->dtls_expected_rx = max(sz + 100, MAX_MTU);
#endif
ret = ReceiveData(ssl, (byte*)data, min(sz, OUTPUT_RECORD_SIZE), peek);