Add support for DTLS fragmentation #49
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Traditional BIO_s_mem ignores DTLS fragmentation. OpenSSL just appends subsequent datagrams to the BIO_s_mem's buffer, which results in losing packet boundaries. This was greatly pointed out by @spscream in #31 and described by Lorenzo in OpenSSL mailing list: https://mailing.openssl.users.narkive.com/L431ya4W/openssl-users-dtls-fragmentation-and-mem-bio (many thanks guys!)
Ignoring DTLS fragmentation may result in DTLS datagrams being dropped when MTU size is not large enough. The ServerHello message, in our setup, is ~1400 bytes. When using Orange as ISP, the MTU size seems to be ~1300 bytes so the ServerHello message is dropped.
Another scenario where our implementation fails is when we use 4096 bits certificate.
To mitigate this issue, we can:
OpenSSL 1.1 EOL was in September 2023. Ubuntu was providing security fixes in Ubuntu 20.04 until 04.2025 (not including pro subscribers, who are receiving security updates for 10 years). Newer versions, like 22.04, migrated to OpenSSL 3.
Hence, we chose the first option (using BIO_s_dgram_mem). If we see anyone still using OpenSSL 1.1, we will consider providing backward compatible solution.Looks likeubuntu-latest
with OTP 26 uses OpenSSL 1.1 (that's the config from our CI) so we go for custom filter.The MTU is hardcoded to 1200.
Resources:
Fixes #31