summaryrefslogtreecommitdiffstats
path: root/apps/s_client.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2014-12-01 23:57:44 +0000
committerMatt Caswell <matt@openssl.org>2014-12-03 09:43:49 +0000
commit82d7247fc5feca45c9a3526582912ccfe8e5f96a (patch)
tree8dbb8d87d1eade8adafa693245da9d5fdec0c9b3 /apps/s_client.c
parentceb4c684e463d560e35833da5f575719b5c5af51 (diff)
Updates to s_client and s_server to remove the constant 28 (for IPv4 header
and UDP header) when setting an mtu. This constant is not always correct (e.g. if using IPv6). Use the new DTLS_CTRL functions instead. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 464ce92026bd0c79186cbefa75470f39607110be)
Diffstat (limited to 'apps/s_client.c')
-rw-r--r--apps/s_client.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/s_client.c b/apps/s_client.c
index 1e377debc0..fb170e256a 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -1018,10 +1018,22 @@ re_start:
BIO_ctrl(sbio, BIO_CTRL_DGRAM_SET_SEND_TIMEOUT, 0, &timeout);
}
- if (socket_mtu > 28)
+ if (socket_mtu)
{
+ if(socket_mtu < DTLS_get_link_min_mtu(con))
+ {
+ BIO_printf(bio_err,"MTU too small. Must be at least %ld\n",
+ DTLS_get_link_min_mtu(con));
+ BIO_free(sbio);
+ goto shut;
+ }
SSL_set_options(con, SSL_OP_NO_QUERY_MTU);
- SSL_set_mtu(con, socket_mtu - 28);
+ if(!DTLS_set_link_mtu(con, socket_mtu))
+ {
+ BIO_printf(bio_err, "Failed to set MTU\n");
+ BIO_free(sbio);
+ goto shut;
+ }
}
else
/* want to do MTU discovery */