-
Notifications
You must be signed in to change notification settings - Fork 2k
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
ng_icmpv6_echo: fix unexpected parameter problem #3311
ng_icmpv6_echo: fix unexpected parameter problem #3311
Conversation
I chose to use |
@PeterKietzmann noted offline that maybe @emmanuelsearch or @OlegHahm should have a look at this, too. For this reason I also reassign to @OlegHahm. |
I will test this asap. Why I proposed to get an opinion from Oleg or Emmanuel: I think the window will fix the sequence bug. But I don't know if it's legit to do so. Thinking theoretical, not practical, I wonder what happens if you try to send 5mio pings (I know it's not realistic or feasible for other components). The offset will theoretically exceed the windows bounds at any time. So one has to select bounds according to a proposed scenario. This selection feels somehow random to me. You get what I'm trying to say :-) ? |
I can confirm that this PR fixes the |
Wait a minute… the event loop in this command is: send packet, wait for reply, send packet, wait for reply, … |
I see the same btw. Yesterday I saw crashes, when dereferencing |
But couldn't this cause a problem if pinging is not performed from the shell? |
This doesn't explain the bug, but shouldn't the stack be able to deal with out-of-order packet reception and duplicates? |
There is no implementation for that… so what do you mean by that.
That's the task of individual layers like TCP. Since we don't use them for ping, the ping application itself is tasked with keeping track of this. |
That this is not implemented (yet) in RIOT master, doesn't mean that it will never happen. Someone might even started to do so in her or his application. I'm just wondering if you took this case into consideration. |
I don't understand this. How can any application(???) make sure that no duplicates are generate or re-ordering happen along the route. Or are you saying that the application can/should be able to handle these cases? |
But than that implementation should also handle this cases.
Not any application. A ping application. I think we are talking past each other here... I'm not really sure what your comments are targeting, since it sound to like you want to put complexities that belong into a ping application into the ICMPv6 implementation of the stack. |
Ah, maybe. I wasn't really looking at the code and just assuming we were talking about ICMPv6 echo here because of the title while this PR is actually about the ping shell command. However, just to make sure: the current ping application (aka the ping shell command) is capable of dealing with duplicates and out-of-order reception, right? |
With this PR, yes. |
(at least in a window of 2¹⁶ - 1 packets ;-), to address @PeterKietzmann's concerns) |
i += 2; | ||
} | ||
else { | ||
payload[i++] = (uint8_t)(seq & 0xff); | ||
payload[i++] = (uint8_t)(id & 0xff); | ||
} | ||
} | ||
|
||
if (i > payload_len) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can this be true?
Edit: Understood it - but would be worth a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
ACK |
Please squash |
Previously it could happen, that the pinging node had send more then one packet before the reply was received. This would cause the sequence number to be bigger than expected on receive. This fixes this problem by introducing a window of expected echo sequence numbers.
9d00069
to
539dd57
Compare
Squashed. |
As @OlegHahm ACKed gave his ACK and the window fixed some issues, I'll click the button now. |
…ted-parameter-problem ng_icmpv6_echo: fix unexpected parameter problem
Previously it could happen, that the pinging node had send more then one
packet before the reply was received. This would cause the sequence
number to be bigger than expected on receive.
This fixes this problem by introducing a window of expected echo sequence
numbers.