From 7e7af0bc516fffbb28b0eb659bfd896a2c051073 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lutz=20J=C3=A4nicke?= Date: Fri, 10 Oct 2008 10:41:35 +0000 Subject: [PATCH] When the underlying BIO_write() fails to send a datagram, we leave the offending record queued as 'pending'. The DTLS code doesn't expect this, and we end up hitting an OPENSSL_assert() in do_dtls1_write(). The simple fix is just _not_ to leave it queued. In DTLS, dropping packets is perfectly acceptable -- and even preferable. If we wanted a service with retries and guaranteed delivery, we'd be using TCP. PR: #1703 Submitted by: David Woodhouse --- ssl/s3_pkt.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c index 7593ad9195..1d6760e515 100644 --- a/ssl/s3_pkt.c +++ b/ssl/s3_pkt.c @@ -828,8 +828,16 @@ int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, s->rwstate=SSL_NOTHING; return(s->s3->wpend_ret); } - else if (i <= 0) + else if (i <= 0) { + if (s->version == DTLS1_VERSION || + s->version == DTLS1_BAD_VER) { + /* For DTLS, just drop it. That's kind of the wh +ole + point in using a datagram service */ + wb->left = 0; + } return(i); + } wb->offset+=i; wb->left-=i; } -- 2.25.1