pkg/tinydtls: add DTLS sock API implementation#11943
Conversation
|
I can start to review the PR until this weekend. Is it OK ? |
|
By the way, @pokgak can you put the link to the previous discussion ? |
#11909 needs to be reviewed and ACK'd first, so it still has some time (sorry, forgot to set the "State: waiting for other PR" label) |
|
@rfuentess, it'd be great if you could review it, there are some places where I'm not really sure about the implementation but as @miri64 said we still have time. In the meantime, I've updated #10897 with a list to track the current status. |
|
Added commits to update the implementation to use the latest API. There are not much changes to the implementation of the API in I think there will no changes anymore to the API proposed in #11909, only refining the example left. So it should be okay to start reviewing this PR @rfuentess . |
|
I finally got some free time. The interface seems to be elegant and clean. At simple glance I don't see anything that requires special attention. I'll try to get some physical boards on the following weeks to play with it. Otherwise, I'll recover my IoT-lab account for it. |
|
I think with #11909 merged this can be rebased. |
|
I guess it also needs some adaptation to the changes we discussed there. |
|
Please rebase, #12299 was merged. |
653e89a to
894ffe5
Compare
|
As 894ffe5 still does exist, I believe you did not rebase to current master ;-) |
|
@rfuentess update on the review? I'm looking into constant-time when copying the credentials in credential callbacks ( |
No, that is not a workaround for the error stated in comment. After #12299 merged, compiling the example gives following error: 894ffe5 is needed to fix it. And I checked git log just in case and #12299 is in the history. |
692429c to
c6517a2
Compare
|
@smlng are your requests competed? Then, please remove the blocking. |
|
please squash |
c6517a2 to
87ce70c
Compare
|
Squashed. |
smlng
left a comment
There was a problem hiding this comment.
tested and works in general, however I observed 2 things:
- cannot start, then stop and start server again, fails with:
dtlss stop
dtlss stop
Stopping server...
Terminating
Success: DTLS server stopped
> dtlss start
dtlss start
Error cannot add credential to system: -1
- further it would be nice to print the message send by
dtlscon server side and/or on client side (after echo). Currently both only report that a message was received but the content is not shown.
Fixed.
I had this discussion with @miri64 before (#11909 (comment)) and there decided against printing the message. |
|
please squash, otherwise ACK. |
fb46966 to
57533a7
Compare
|
@smlng sorry for the delay. I tested part of the tests from #11943 (comment) again on |
|
okay ... cool, lets see what murdock thinks |
|
Murdock is happy and so am I 😃 |
|
well then let's do this! |
|
Congrats @pokgak ! |
|
Thank you all for helping with the review :) |
| struct sock_dtls { | ||
| dtls_context_t *dtls_ctx; /**< TinyDTLS context for sock */ | ||
| sock_udp_t *udp_sock; /**< Underlying UDP sock to use */ |
There was a problem hiding this comment.
What was the reason for not doing
| struct sock_dtls { | |
| dtls_context_t *dtls_ctx; /**< TinyDTLS context for sock */ | |
| sock_udp_t *udp_sock; /**< Underlying UDP sock to use */ | |
| sock_udp_t udp_sock; /**< Underlying UDP sock to use */ | |
| dtls_context_t *dtls_ctx; /**< TinyDTLS context for sock */ |
instead?
That way application code using UDP sockets could transparently handle DTLS sockets (after a custom setup procedure).
sock_udp_t would only need to be extended by a flag to indicate there is a DTLS context attached to it.
There was a problem hiding this comment.
We might want to support other transports in the future. With that, it would be easier and better understandable to create the transport sock in the application first and then the DTLS sock. As we do not want to copy that transport sock, a pointer is the best way to go here.
Contribution description
This PR implements the DTLS sock API introduced in #11909 using tinyDTLS. It adds an example application dtls-sock that follows the same behavior as the existing dtls-echo example.
Testing procedure
Run the example application using two nodes.
Start a DTLS server on one node and get the IP:
Send a message from the other node to the server:
PSK credentials are used by default. To test with ECC credentials, uncomment following line in Makefile:
Using ECC credentials is a bit iffy currently. It works but takes too long (>10s) to send and receive the data. Probably the same problem as #11859.
Issues/PRs references
Depends on PR #11909.
Earlier discussion in #10897