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
Border cases in packet number decoding #674
Comments
what I have done is interpreted that given 16 bits of recvd = 0x8000, and expected = 0x10001 .. the packet is decoded as 0x8000 because 0x8000 is closer to 0x10001 than the other choice 0x18000 nonetheless, I would much prefer packet numbers to be concrete 64 bit numbers variably length encoded somehow. |
Can you clarify what the ambiguity is? 0x8000 is closer to 0x10001 than 0x18000 is as Patrick said, so you choose 0x8000. Minus the variable length aspect, I don't believe this is that dissimilar from how TCP decodes sequence numbers, is it? |
Actually, in this case 0x18000 is closer by 2: But Patrick's logical reasoning is still correct. |
hah - yes. a little base-10 brain action. |
Thanks for the explanation. Right now, I am just trying to write test vectors, and I was little bit puzzled. So, to keep my example, the test vector will be: Of course, this algorithm breaks down in this particular case: |
Yes. There is a single case where the decoded value could equally be one of two different values. Given that this is a corner case, and given that I don't think that the specific answer matters, can someone toss a coin and tell me which one to use? Failing that, I'll pick Christian's answer (the lower value). |
The lower value is fine. It really should never matter since we'd expect to only receive packets within 1/4 of expressible range, just like TCP sequence numbers aren't supposed to use the entire space. At some point, Jana and I considered recommending the peer close the connection if the packet number was in the half of the space you don't expect, but we weren't convinced that was actually helpful. |
Adding pseudocode and tweaking the existing text should clarify this. |
I agree that adding pseudo code will solve the issue. |
Closed by #1493. |
I am afraid that the specification of packet number decoding in the transport spec is a bit ambiguous.
The transport spec says:
So, let's suppose a node that is processing a packet. The packet header says that the packet number is encoded on 2 bytes, and the value is PN=0x8000. The highest received number is R=0x10000. Should the receiver expand PN to PN64=0x180000, or to PN64=0x8000?
The text was updated successfully, but these errors were encountered: