Skip to content

gnrc_ipv6_nib: fix for 'holey' NIB#7926

Merged
miri64 merged 2 commits intoRIOT-OS:gnrc_netif2_integration/masterfrom
miri64:gnrc_ipv6_nib/fix/iter-over-holes
Nov 9, 2017
Merged

gnrc_ipv6_nib: fix for 'holey' NIB#7926
miri64 merged 2 commits intoRIOT-OS:gnrc_netif2_integration/masterfrom
miri64:gnrc_ipv6_nib/fix/iter-over-holes

Conversation

@miri64
Copy link
Copy Markdown
Member

@miri64 miri64 commented Nov 1, 2017

When there are holes in the NIB (e.g. when entries were removed) currently the NIB crashes the system due to a failed assertion (DEVELHELP needs to be activated to test this behavior).

This fixes this behavior by making the assertion a check that is always compiled in.

Test cases to show the bug before this fix are provided (again: DEVELHELP needs to be activated to show the crash).

@miri64 miri64 added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) GNRC Area: network Area: Networking labels Nov 1, 2017
@miri64 miri64 requested a review from cgundogan November 1, 2017 18:41
@miri64 miri64 added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 1, 2017
@miri64 miri64 force-pushed the gnrc_ipv6_nib/fix/iter-over-holes branch from 7682c2c to 51b3834 Compare November 1, 2017 18:50
@bergzand
Copy link
Copy Markdown
Member

bergzand commented Nov 8, 2017

Is the iterator in sys/net/gnrc/network_layer/ipv6/nib/nib_nc.c not affected by this issue?

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Nov 8, 2017

TL;DR: No.

Only the off-link types are affected by that because they have the next_hop pointer (the neighbor cache itself is of the type the next_hop), which was assumed to always be not NULL in the iteration (which isn't the case if e.g. an entry in-between was removed). For more information on the internal structure of the NIB see my (incomplete) model.

Copy link
Copy Markdown
Member

@bergzand bergzand left a comment

Choose a reason for hiding this comment

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

A few small nittpicks, nothing too serious here.

}

/**
* Creates three default routes and removes one
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe clarify here that the first one is removed: "…and removes the first one."

}

/**
* Creates three prefix based routes and removes the second one
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Missing period.

* Expected result: there should be two prefix list entries returned, the first
* and the third one
*/
static void test_nib_pl_iter__empty_in_the_middle(void)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why test here only the removal of the middle entry and not also the removal of the first as with the routes?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I only tested the removal of the first one with the routes because for default routes I have no control which one is removed (which I realize might be an issue iff people have multiple default routes [which on an embedded system I would highly discourage anyway], but this is not the topic of this PR)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok

}

/**
* Creates three prefix list entries and removes the second one
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

missing period.

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Nov 9, 2017

Addressed comments

Copy link
Copy Markdown
Member

@bergzand bergzand left a comment

Choose a reason for hiding this comment

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

Changes look good.

@miri64 miri64 force-pushed the gnrc_ipv6_nib/fix/iter-over-holes branch from b11f182 to dcac0a5 Compare November 9, 2017 13:36
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Nov 9, 2017

Squashed

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Nov 9, 2017

Oops rebased to wrong branch -.-

When there are holes in the NIB (e.g. when entries were removed)
currently the NIB crashes the system due to a failed assertion.
This commit tests this behavior (`DEVELHELP` needs to be activated to
test this behavior). A fix will follow.
When there are holes in the NIB (e.g. when entries were removed)
currently the NIB crashes the system due to a failed assertion
(`DEVELHELP` needs to be activated to test this behavior).

This fixes this behavior by making the assertion a check that is always
compiled in.
@miri64 miri64 force-pushed the gnrc_ipv6_nib/fix/iter-over-holes branch from dcac0a5 to 72db5e4 Compare November 9, 2017 14:29
@miri64 miri64 merged commit b187c04 into RIOT-OS:gnrc_netif2_integration/master Nov 9, 2017
@miri64 miri64 deleted the gnrc_ipv6_nib/fix/iter-over-holes branch November 9, 2017 20:42
@aabadie aabadie added this to the Release 2018.01 milestone Jan 18, 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.

4 participants