session.h: Modify session_t for RIOT#127
Conversation
|
In order to contribute to a Eclipse project, you need to sign a ECA, see CONTRIBUTING. |
|
Let me propose to change the order of the fields to: that's common in the posix definitions. should consider the Finally, I think to prevent the root-cause from happens in other ports (contiki-ng), the documentation of the |
|
Do you go to sign the ECA? |
I will, I'm just having some issue to validate my email address for some reason...
Yes, as a matter of fact RIOT-OS/RIOT#17765 has been merged recently, adding IPv4. I'll update this PR with your comments and also with IPv4 support. |
|
@leandrolanzieri I already have a PR open for IPv4: #129 ;) |
Ok, then no need for this one as yours is already including my changes |
Great to read.
You may need a line as as the last in the comment of your commit. (You must use the same e-mail address used for the ECA). (I have checked it, currently there is no ECA for "leandro.lanzieri@haw-hamburg.de".) |
Yeah, I did it once with another email, which is also on my GH account (lanzierileandro@gmail.com). Is there a way to add a second address? |
Not sure. Isn't it easier to use then the e-mail address of the ECA for the commit? (By the way, I was able the check the ECA for lanzierileandro@gmail.com, it's valid.) |
Now the addr member of session_t includes both the IPv6 address and the port. Signed-off-by: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
Signed-off-by: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
6fbe634 to
a45122b
Compare
|
I created a new account with leandro.lanzieri@haw-hamburg.de email address and added the signed-off line to both commits |
|
That legal validation stuff is somehow tricky. And doesn't like twins ;-) Currently the page of the validation shows "leandrolanzieri" as user. Is that your previous or your new account? (I was able to check the ECA for the leandro.lanzieri@haw-hamburg.de and it's valid now.) |
That's the new username |
Hmm is there something wrong with the commit message then? |
|
Not sure, why the validation fails. Anyway, my comment for more documentation about the I would consider, to prevent others, maybe future ports, from that pitfall, to add a general commet ahead of the #ifdefs with the guidance to |
I guess, not. I can't see something wrong. You may add a "." at the end, but I'm not sure, if that changes anything. |
|
Just in the case, you can spent some minutes into the ECA verification stuff. |
Ok I will add the documentation before then. But this raises a question: https://github.com/eclipse/tinydtls/blob/706888256c3e03d9fcf1ec37bb1dd6499213be3c/session.c#L62-L67 |
|
Yes, good question.
I guess, we need some guidance by @obgm . |
I try to Revalidate it but still get the same issue. I double check that :
So from my point of view, this checks failure should not prevent a committer to merge this PR. (This is probably just a eclipsefdn/eca tool bug). (I mean this can just be ignored) Note also that I think (not sure) that "Signed-off-by" is no more mandatory, the commit author is enough now. |
|
Thanks for double checking it. I also tried "revalidate" and it didn't work (I got also some "The answer you entered for the CAPTCHA was not correct." without such a CAPTCHA at all.)
AFAIK, that's not longer required for the comment at the PR itself. |
|
We have to switch to Windows and Internet Explorer, only that sees the I opened a ticket about that in the helpdesk (Using Windows and Internet Explorer I was able to successfully revalidate the PR.) |
😱
Just see via the related issue that leshan web site doesn't work too. 😬 |
Yes, |
I guess, the term |
This is not the case if the IMO it makes sense that the UDP port is part of the cookie, otherwise we may have the case of repeated cookies for handshakes initiated from different ports. I think it would make sense to force that |
Just as a reference that it would be good to consider the port for the cookie generation: RFC 6347 Section 4.2.1 states that:
Which references to RFC 2522. Under its Section 3.3 it states:
And in Section 3.3.1:
|
|
If the term But I'm not sure, if |
In RIOT it has always been initialized to the remote endpoint UDP port. |
|
|
|
But I think, the discussion shows, that the concepts behind the fields
|
As
I don't agree. Going back to the implementation of https://github.com/eclipse/tinydtls/blob/706888256c3e03d9fcf1ec37bb1dd6499213be3c/session.c#L66
Not according
This was not the issue. We were using only IPv6, as IPv4 was not there yet. But as
As suggested above, I think the best way is to group all the information about the remote endpoint in |
OK, thanks for clarification.
agreed. |
|
How should we proceed? I was thinking maybe we can define types per platform port: Maybe instead of |
|
FMPOV: Tinydtls itself (the library, not the examples) depends not on something as the representation of the IP address. To clean that up: In my opinion, the tinydtls library itself should just go for the For the usage on the application layer (e.g. "dtls_client.c"), it's nice to use the data required to easily interact with the API, so the same would apply for RIOT. And the main function required is just the That's very close to the current implementation, but without accessing the "addr" (or any other field).
I may be wrong, but that sounds, that (If I'm wrong, the the approach to "always use the complete session_t" would not work.) |
It was not called, because the size it would set does not consider the port, so it was set manually. The issue was that |
|
Thanks, @boaks and @leandrolanzieri for the thorough analysis. I like @boaks's suggested abstraction for cookie creation, session comparison and peer retrieval. And, as these functions need to include some means of identifying the remote peer, the low-level part needs to be platform-specific as suggested by @leandrolanzieri. I am happy to process this PR (especially considering that PR #129 depends on this and is already in use for RIOT) and do the suggested improvements later. What do you think? |
|
Yes, merging this now and address the general remarks later makes sense. |
|
And here we go! |
As described in RIOT-OS/RIOT#17849, having
portandaddras separate fields in thesession_twas causing in certain scenarios to include random bytes (possible due to padding) to the hash calculation for the cookie. This would in turn cause the server to generate inconsistent cookies, thus failing to perform the handshake.This PR joins the port and the IPv6 address into a single member, which is used to calculate the size.