Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
2451fb36
Commit
2451fb36
authored
6 years ago
by
Martine Lenders
Browse files
Options
Downloads
Patches
Plain Diff
tests: add unittest for state corruption in NC cache-out
parent
660440c1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c
+35
-0
35 additions, 0 deletions
...ttests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c
with
35 additions
and
0 deletions
tests/unittests/tests-gnrc_ipv6_nib/tests-gnrc_ipv6_nib-internal.c
+
35
−
0
View file @
2451fb36
...
...
@@ -492,6 +492,40 @@ static void test_nib_nc_add__success_full_but_garbage_collectible(void)
}
}
/*
* Creates GNRC_IPV6_NIB_NUMOF neighbor cache entries with different IP
* addresses and a garbage-collectible AR state and then tries to add
* 3 more after removing two.
* Expected result: should not crash
*
* See https://github.com/RIOT-OS/RIOT/pull/10975
*/
static
void
test_nib_nc_add__cache_out_crash
(
void
)
{
_nib_onl_entry_t
*
node1
,
*
node2
;
ipv6_addr_t
addr
=
{
.
u64
=
{
{
.
u8
=
GLOBAL_PREFIX
},
{
.
u64
=
TEST_UINT64
}
}
};
for
(
int
i
=
0
;
i
<
GNRC_IPV6_NIB_NUMOF
-
2
;
i
++
)
{
TEST_ASSERT_NOT_NULL
(
_nib_nc_add
(
&
addr
,
IFACE
,
GNRC_IPV6_NIB_NC_INFO_NUD_STATE_STALE
));
addr
.
u64
[
1
].
u64
++
;
}
TEST_ASSERT_NOT_NULL
((
node1
=
_nib_nc_add
(
&
addr
,
IFACE
,
GNRC_IPV6_NIB_NC_INFO_NUD_STATE_STALE
)));
addr
.
u64
[
1
].
u64
++
;
TEST_ASSERT_NOT_NULL
((
node2
=
_nib_nc_add
(
&
addr
,
IFACE
,
GNRC_IPV6_NIB_NC_INFO_NUD_STATE_STALE
)));
addr
.
u64
[
1
].
u64
++
;
_nib_nc_remove
(
node1
);
_nib_nc_remove
(
node2
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
TEST_ASSERT_NOT_NULL
(
_nib_nc_add
(
&
addr
,
IFACE
,
GNRC_IPV6_NIB_NC_INFO_NUD_STATE_STALE
));
addr
.
u64
[
1
].
u64
++
;
}
}
/*
* Creates a neighbor cache entry and sets it reachable
* Expected result: node->info flags set to NUD_STATE_REACHABLE and NIB's event
...
...
@@ -1935,6 +1969,7 @@ Test *tests_gnrc_ipv6_nib_internal_tests(void)
new_TestFixture
(
test_nib_nc_add__success_duplicate
),
new_TestFixture
(
test_nib_nc_add__success
),
new_TestFixture
(
test_nib_nc_add__success_full_but_garbage_collectible
),
new_TestFixture
(
test_nib_nc_add__cache_out_crash
),
new_TestFixture
(
test_nib_nc_remove__uncleared
),
new_TestFixture
(
test_nib_nc_remove__cleared
),
new_TestFixture
(
test_nib_nc_set_reachable__success
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment