Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accumulating multiple packets into a single datagram before writing into network. #12

Open
VPBalaRama opened this issue Jun 16, 2020 · 2 comments

Comments

@VPBalaRama
Copy link

Hi
I have attached the screenshot of the DTLS Handshake pcap. Here my client certificate of length 3100+ bytes is fragmented to smaller chunks of 1500 bytes(MTU size) and written into the socket. While writing into the network, all packets(fragmented chunks) are accumulated into a single datagram.

And Handshake is failing with error new fragment overlaps the older data.

Please let me know to how to disable the accumulation of multiple packets in to single datagram. i couldn't find the UDP_CORK option here.
Capture

Capture

@sdamm
Copy link
Owner

sdamm commented Jun 17, 2020

When using the stateless cookie exchange method, it is required that openssl sends the client Hello as one single Packet (it will be split by the IP-Layer if needed, that is expected). To accomplish that you can use the set_mtu method of the dtls socket (client side) to set the MTU to a size bigger than the expected Handshake Packet. The MTU set here actually does not matter after the handshake as every send / async_send corresponds to one UDP Packet, so the application has to match the MTU when sending anyway.

I guess a

socket.set_mtu(60000); // Check that this is big enough

on the client side before the handshake should fix your problem.

@adminins
Copy link

Hi I have attached the screenshot of the DTLS Handshake pcap. Here my client certificate of length 3100+ bytes is fragmented to smaller chunks of 1500 bytes(MTU size) and written into the socket. While writing into the network, all packets(fragmented chunks) are accumulated into a single datagram.

And Handshake is failing with error new fragment overlaps the older data.

Please let me know to how to disable the accumulation of multiple packets in to single datagram. i couldn't find the UDP_CORK option here. Capture

Capture

hello,can you give me a DTLS demo use ASIO library and send code to my e-mail:[email protected],Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants