DTLS_GET_DATA_MTU(3ssl)
π DTLS_GET_DATA_MTU(3ssl) β the OpenSSL girlies' guide to DTLS MTU handling π
okay bestie, so this page is from the OpenSSL manual, section 3ssl, and it's all about MTU stuff for DTLS. four functions, one very specific vibe. let's get into it β¨
πΈ NAME πΈ
DTLS_get_data_mtu, DTLS_set_link_mtu, DTLS_get_link_min_mtu, SSL_set_mtu β literally all of DTLS MTU handling, together, slaying π
β¨ SYNOPSIS β¨
#include <openssl/ssl.h>
size_t DTLS_get_data_mtu(const SSL *ssl);
long DTLS_set_link_mtu(SSL *ssl, long mtu);
long DTLS_get_link_min_mtu(SSL *ssl);
long SSL_set_mtu(SSL *ssl, long mtu);
π¦ DESCRIPTION π¦
okay so here's the tea on each one:
DTLS_get_data_mtu() obtains the maximum data payload size for the established DTLS connection ssl, based on the DTLS record MTU and the overhead of the DTLS record header, encryption and authentication currently in use. basically: how much actual data can you cram in there once the headers and crypto have taken their cut π
DTLS_set_link_mtu() sets the link layer MTU for the DTLS connection ssl to mtu. this is the maximum on-the-wire packet size including IP and UDP headers β like the whole packet, headers and all, no cap. OpenSSL subtracts the IP/UDP overhead internally to determine the maximum DTLS record size, and uses this to fragment handshake messages and limit the size of application data records. so you give it the big number, it does the math for you π«Ά
DTLS_get_link_min_mtu() returns the minimum link MTU that OpenSSL will use for the DTLS connection ssl. this is the smallest MTU that still allows DTLS to function properly β the absolute floor, the bare minimum, going any lower is giving broken connection energy π
SSL_set_mtu() sets the DTLS record-level MTU for the connection ssl to mtu. and here's the key difference bestie β unlike DTLS_set_link_mtu(), this value should not include IP or UDP header overhead; it represents the maximum DTLS packet size directly. two different numbers, two different layers, do not mix them up π
ngl, mixing up the link-level and record-level MTU is the classic mistake, so double-check which one you're calling before you start blaming the network β¨
π RETURN VALUES π
DTLS_get_data_mtu()β returns the maximum data payload size on success, or0on failure.DTLS_set_link_mtu()β returns1on success or0on failure.SSL_set_mtu()β returns the MTU value on success or0on failure.DTLS_get_link_min_mtu()β returns the minimum link MTU value.
lowkey love that DTLS_set_link_mtu() is just a vibe check: 1 good, 0 bad, no in between π₯
β HISTORY β
DTLS_get_data_mtu()was added in OpenSSL 1.1.1.SSL_set_mtu()was added in OpenSSL 0.9.8. she's an icon, she's a legend, she's the oldest one here πDTLS_set_link_mtu()andDTLS_get_link_min_mtu()were added in OpenSSL 1.0.2.
π COPYRIGHT π
Copyright 2016-2026 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie, you ate that π this has been version 4.1.0, dated 2026-10-23, brought to you by DTLS_GET_DATA_MTU(3ssl) β now go forth and fragment responsibly ππ§
π¦ where this page comes from
- nixos 26.05: openssl 4.1.0
- nixpkgs unstable: openssl 4.1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms