DTLS_GET_DATA_MTU(3ssl)

πŸ“¦ version 4.1.0, in nixos 26.05, nixpkgs unstable

πŸ’… 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, or 0 on failure.
  • DTLS_set_link_mtu() β€” returns 1 on success or 0 on failure.
  • SSL_set_mtu() β€” returns the MTU value on success or 0 on 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() and DTLS_get_link_min_mtu() were added in OpenSSL 1.0.2.

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