[glib-networking/wip/pwithnall/dtls: 2/13] gnutls: Convert MTU-exceeded errors
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/wip/pwithnall/dtls: 2/13] gnutls: Convert MTU-exceeded errors
- Date: Thu, 2 Nov 2017 13:32:26 +0000 (UTC)
commit 810626e4ca40ac9b520467ae1c9e42fe918814c6
Author: Olivier CrĂȘte <olivier crete collabora com>
Date: Fri Mar 29 18:43:22 2013 -0400
gnutls: Convert MTU-exceeded errors
This is necessary for handling DTLS datagrams, as GnuTLS enforces an MTU
on them.
https://bugzilla.gnome.org/show_bug.cgi?id=697908
tls/gnutls/gtlsconnection-gnutls.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index 5a62b4d..aa76872 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -25,6 +25,7 @@
#include <errno.h>
#include <stdarg.h>
+#include <gnutls/dtls.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
@@ -860,6 +861,14 @@ end_gnutls_io (GTlsConnectionGnutls *gnutls,
gnutls_alert_get_name (gnutls_alert_get (gnutls->priv->session)));
return status;
}
+ else if (status == GNUTLS_E_LARGE_PACKET)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_MESSAGE_TOO_LARGE,
+ _("Message is too large for DTLS connection; maximum is "
+ "%u bytes"),
+ gnutls_dtls_get_data_mtu (gnutls->priv->session));
+ return status;
+ }
if (error)
{
@@ -1090,6 +1099,8 @@ set_gnutls_error (GTlsConnectionGnutls *gnutls,
gnutls_transport_set_errno (gnutls->priv->session, EINTR);
else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT))
gnutls_transport_set_errno (gnutls->priv->session, EINTR);
+ else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_MESSAGE_TOO_LARGE))
+ gnutls_transport_set_errno (gnutls->priv->session, EMSGSIZE);
else
gnutls_transport_set_errno (gnutls->priv->session, EIO);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]