-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Perform extra checks on CoAP message size
This fixes the logic for checking the maximum CoAP message size. The check is actually performed in the coap-packet repository in a default parameter on the `generate()` function, however the default value is not appropriate for all (if any) cases. The maximum size that a CoAP message can be is the IP MTU, minus the IP header and minus the UDP header. The value is not constant across all IP network stacks, so the CoAP specification recommends a maximum of 1152 bytes for cases where it is not known. The only way to know for sure is MTU path discovery, which is way outside of the scope of the project. This commit creates a parameter that allows the max packet size to be adjusted as a server parameter for cases where (for example) the server is running on a 6LoWPAN/Thread network and needs a lower maximum message size. Note that the logic for enforcing the size is just to throw an error and crash the server. However, since the maximum payload size is enforced a situation like that should never occur.
- Loading branch information
Showing
4 changed files
with
21 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters