Skip to content

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Mar 14, 2019

Contribution description

According to the documentation of gnrc_ipv6_nib_get_next_hop_l2addr() pkt may be NULL. However, whenever that function sends an error message (the methods for that require orig_pkt not to be NULL) pkt is not checked, which may lead to failed assertions.

Testing procedure

Issues/PRs references

Compile and flash tests/gnrc_ipv6_nib with USEMODULE=gnrc_icmpv6_error

USEMODULE=gnrc_icmpv6_error make flash

and run the test

make test

Without this fix the test will fail on an assertion at

With this fix the tests will pass.

Issues/PRs references

Discovered while debugging #11068 where I use gnrc_ipv6_nib_get_next_hop_l2addr() with pkt == NULL

if (!ipv6_addr_is_link_local(addr) &&
(gnrc_netif_get_by_ipv6_addr(addr) == NULL) &&
(gnrc_ipv6_nib_get_next_hop_l2addr(addr, netif, NULL,
&nce) == 0)) {

According to the documentation of `gnrc_ipv6_nib_get_next_hop_l2addr()`
`pkt` may be `NULL`. However, whenever that function sends an error
message (the methods for that require `orig_pkt` not to be NULL) `pkt`
is not checked, which may lead to failed assertions.
@miri64 miri64 added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Mar 14, 2019
@miri64 miri64 added this to the Release 2019.04 milestone Mar 14, 2019
@miri64 miri64 requested review from cgundogan and bergzand March 14, 2019 13:39
@miri64 miri64 added CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable labels Mar 27, 2019
Copy link
Member

@cgundogan cgundogan left a comment

Choose a reason for hiding this comment

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

Code looks sensible. Fixes the failed assertion in the test application. ACK

@cgundogan cgundogan added Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines labels Mar 27, 2019
@miri64 miri64 merged commit aa8e760 into RIOT-OS:master Mar 27, 2019
@miri64 miri64 deleted the gnrc_ipv6_nib/fix/pkt-null-on-error branch March 27, 2019 17:39
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 Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines 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.

2 participants