Skip to content
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

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Jul 3, 2015

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.

@miri64 miri64 added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) NSTF labels Jul 3, 2015
@miri64 miri64 added this to the Release 2015.06 milestone Jul 3, 2015
@miri64
Copy link
Member Author

miri64 commented Jul 3, 2015

I chose to use id for the payload from now on, since seq now is a little bit more complicated. id should not cause a problem, since the shell command assumes that the shell is blocked anyways, so id does not change during one execution.

@miri64
Copy link
Member Author

miri64 commented Jul 3, 2015

@PeterKietzmann noted offline that maybe @emmanuelsearch or @OlegHahm should have a look at this, too. For this reason I also reassign to @OlegHahm.

@miri64 miri64 assigned OlegHahm and unassigned PeterKietzmann Jul 3, 2015
@PeterKietzmann
Copy link
Member

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 :-) ?

@PeterKietzmann
Copy link
Member

I can confirm that this PR fixes the unexpected parameters bug. Still I get packet buffer full behaviour. Details in the offline spreadsheet.

@miri64
Copy link
Member Author

miri64 commented Jul 4, 2015

Wait a minute… the event loop in this command is: send packet, wait for reply, send packet, wait for reply, …
So how does it happen, that an older packet arrives, when it should be handled before the next packet goes out? My suggestion: there is a duplicate in the message queue, which would also explain a double release on a packet. Maybe related to #1811?

@miri64
Copy link
Member Author

miri64 commented Jul 4, 2015

I can confirm that this PR fixes the unexpected parameters bug. Still I get packet buffer full behaviour. Details in the offline spreadsheet.

I see the same btw. Yesterday I saw crashes, when dereferencing 0x80789f2 <_buf+210> (which became 0x7), but since my computer crashed afterwards due to heavy load (which it does from time to time because it's not that new anymore), I'm not sure if this result was valid.

@OlegHahm
Copy link
Member

OlegHahm commented Jul 6, 2015

id should not cause a problem, since the shell command assumes that the shell is blocked anyways, so id does not change during one execution.

But couldn't this cause a problem if pinging is not performed from the shell?

@OlegHahm
Copy link
Member

OlegHahm commented Jul 6, 2015

So how does it happen, that an older packet arrives, when it should be handled before the next packet goes out?

This doesn't explain the bug, but shouldn't the stack be able to deal with out-of-order packet reception and duplicates?

@miri64
Copy link
Member Author

miri64 commented Jul 6, 2015

But couldn't this cause a problem if pinging is not performed from the shell?

There is no implementation for that… so what do you mean by that.

This doesn't explain the bug, but shouldn't the stack be able to deal with out-of-order packet reception and duplicates?

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.

@OlegHahm
Copy link
Member

OlegHahm commented Jul 6, 2015

There is no implementation for that… so what do you mean by that.

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.

@OlegHahm
Copy link
Member

OlegHahm commented Jul 6, 2015

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.

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?

@miri64
Copy link
Member Author

miri64 commented Jul 6, 2015

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.

But than that implementation should also handle this cases.

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?

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.

@OlegHahm
Copy link
Member

OlegHahm commented Jul 6, 2015

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?

@miri64
Copy link
Member Author

miri64 commented Jul 6, 2015

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.

@miri64
Copy link
Member Author

miri64 commented Jul 6, 2015

(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) {
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@OlegHahm OlegHahm added the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label Jul 7, 2015
@OlegHahm
Copy link
Member

OlegHahm commented Jul 7, 2015

ACK

@OlegHahm
Copy link
Member

OlegHahm commented Jul 7, 2015

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.
@miri64 miri64 force-pushed the ng_icmpv6_echo/fix/unexpected-parameter-problem branch from 9d00069 to 539dd57 Compare July 7, 2015 23:46
@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable labels Jul 7, 2015
@miri64
Copy link
Member Author

miri64 commented Jul 7, 2015

Squashed.

@PeterKietzmann
Copy link
Member

As @OlegHahm ACKed gave his ACK and the window fixed some issues, I'll click the button now.

PeterKietzmann added a commit that referenced this pull request Jul 8, 2015
…ted-parameter-problem

ng_icmpv6_echo: fix unexpected parameter problem
@PeterKietzmann PeterKietzmann merged commit 8456c9c into RIOT-OS:master Jul 8, 2015
@miri64 miri64 deleted the ng_icmpv6_echo/fix/unexpected-parameter-problem branch July 9, 2015 10:38
@miri64 miri64 added the Area: network Area: Networking label Sep 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants