[glib-networking/wip/pwithnall/dtls: 13/13] gnutls: Set reasonable MTU as the default for DTLS only
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/wip/pwithnall/dtls: 13/13] gnutls: Set reasonable MTU as the default for DTLS only
- Date: Thu, 2 Nov 2017 13:33:21 +0000 (UTC)
commit e1d03a2eab6523c56a114ac20056e68dcc7a54ee
Author: Olivier CrĂȘte <olivier crete collabora com>
Date: Wed Mar 2 17:28:26 2016 -0500
gnutls: Set reasonable MTU as the default for DTLS only
Ignore it for regular TLS
https://bugzilla.gnome.org/show_bug.cgi?id=697908
tls/gnutls/gtlsconnection-gnutls.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index 213be9f..82fd136 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -399,6 +399,10 @@ g_tls_connection_gnutls_initable_init (GInitable *initable,
g_tls_connection_gnutls_vec_push_func);
}
+ /* Set reasonable MTU */
+ if (flags & GNUTLS_DATAGRAM)
+ gnutls_dtls_set_mtu (gnutls->priv->session, 1400);
+
/* Create output streams if operating in streaming mode. */
if (!(flags & GNUTLS_DATAGRAM))
{
@@ -2408,7 +2412,8 @@ g_tls_connection_gnutls_write_message (GTlsConnectionGnutls *gnutls,
for (i = 0, total_message_size = 0; i < num_vectors; i++)
total_message_size += vectors[i].size;
- if (gnutls_dtls_get_data_mtu (gnutls->priv->session) < total_message_size)
+ if (gnutls->priv->base_socket != NULL &&
+ gnutls_dtls_get_data_mtu (gnutls->priv->session) < total_message_size)
{
ret = GNUTLS_E_LARGE_PACKET;
g_set_error (error, G_IO_ERROR, G_IO_ERROR_MESSAGE_TOO_LARGE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]