Skip to content

Increased allocated netbufs to handle DTLS handshakes #1596

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

Merged
merged 1 commit into from
Mar 14, 2016
Merged

Increased allocated netbufs to handle DTLS handshakes #1596

merged 1 commit into from
Mar 14, 2016

Conversation

geky
Copy link
Contributor

@geky geky commented Mar 7, 2016

UDP based protocols such as DTLS may fragment large packets, resulting in many packets being sent at once. This can lead to significant/irrecoverable packet loss on systems that respond to packets slower than network transfers.

Increasing MEMP_NUM_NETBUF to 8 allows lwip to handle a DTLS handshake successfully and should be more robust for similar protocols.

DTLS handshake:
https://tools.ietf.org/html/rfc4347#section-4.2.3

UDP based protocols such as DTLS may fragment large packets, resulting
in many packets being sent at once. This can lead to significant/irrecoverable
packet loss on systems that respond to packets slower than network transfers.

Increasing MEMP_NUM_NETBUF to 8 allows lwip to handle a DTLS handshake
successfully and should be more robust for similar protocols.

DTLS handshake:
https://tools.ietf.org/html/rfc4347#section-4.2.3
@0xc0170
Copy link
Contributor

0xc0170 commented Mar 8, 2016

Can you please add the description provided here to the commit message ?

What's the default value?

@adamgreen
Copy link
Contributor

I thought the purpose of lwipopts.h was for people to customize the lwip memory footprint for their particular networking needs. No single configuration for the options will probably work for everyone. Now if the stock configuration was so limited that it couldn't even use core networking protocols like ARP, DHCP, DNS, etc. then I could see why you would want to modify them. Maybe this is one of those cases?

So I guess my question is whether DTLS is something that the mbed needs to support out of the gate or is it ok that people who do use it need to tweak these settings to customize the memory usage for their needs. Would it be enough that there is a note in the documentation for any DTLS or similar protocol library indicating that these options need to be modified?

I have no opinion one way or the other but I just thought these were questions that should be asked.

@sg-
Copy link
Contributor

sg- commented Mar 8, 2016

I think the default setting should be able to support TLS/DTLS as much as core protocols as suggested by @adamgreen . @geky can you share what the RAM size impact is from this patch?

@geky
Copy link
Contributor Author

geky commented Mar 8, 2016

@0xc0170
Can do, should be updated.
The default value is 4 netbufs.

@sg-
This change adds a total of 180 bytes to bss in gcc with -Os.

I agree with @adamgreen that this change is dependent on how important DTLS is for mbed. Although, if you're going to add documentation on the shortcoming, I don't understand why you wouldn't just provide defaults that avoid the shortcoming entirely. I think customization should be necessary for optimization not functionality.

Currently I have a custom lwipopts.h that works, although my 2¢ is that out-of-the-box mbed support for DTLS is a good idea.

@adamgreen
Copy link
Contributor

👍

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 9, 2016

If there's no refusal for this change, we shall merge this

0xc0170 added a commit that referenced this pull request Mar 14, 2016
Increased allocated netbufs to handle DTLS handshakes
@0xc0170 0xc0170 merged commit fec574a into ARMmbed:master Mar 14, 2016
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

Successfully merging this pull request may close these issues.

4 participants