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

nib: some fixes when a router or a prefix is deleted #20329

Merged
merged 4 commits into from
Jun 10, 2024

Conversation

fabian18
Copy link
Contributor

@fabian18 fabian18 commented Feb 1, 2024

Contribution description

I still had some fixes for NIB lying around.
I remember they were necessary during my thesis.
The fixes are old and probably would need some confirmation, but I think they are still valid.

Testing procedure

I will try to show their necessity by adding something to our tests.

Issues/PRs references

@github-actions github-actions bot added Area: network Area: Networking Area: sys Area: System labels Feb 1, 2024
@fabian18 fabian18 requested a review from benpicco February 1, 2024 18:28
@benpicco benpicco added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Feb 1, 2024
@riot-ci
Copy link

riot-ci commented Feb 1, 2024

Murdock results

✔️ PASSED

bb9ca2e tests/net/gnrc_ipv6_nib: add tests for router and prefix timeout

Success Failures Total Runtime
10006 0 10008 07m:34s

Artifacts

@github-actions github-actions bot added the Area: tests Area: tests and testing framework label Feb 2, 2024
miri64
miri64 previously requested changes Feb 5, 2024
Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

I will try to show their necessity by adding something to our tests.

Yes please!

However, there are some obvious no brainers, which I'd like to merge ASAP (specifically, the clearing of timers on entry removal). Could you split them out into dedicated PRs?

sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c Outdated Show resolved Hide resolved
/* there is another dst pointing to next-hop => only remove dst */
if ((dst != ptr) && (dst->next_hop == ptr->next_hop)) {
break;
if (dst->mode == _EMPTY) {
Copy link
Member

Choose a reason for hiding this comment

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

This changes the semantics from "Clear off link entry" to "Clear off link entry only if removed from every view"... So please give your reasoning for this. Maybe the the function was used wrong somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Assume it was not _EMPTY. Simply memsetting it could be fatal.

Copy link
Member

Choose a reason for hiding this comment

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

I'd argue: then don't call this function, but ok, let's go this route. But no guarantee if this introduces new bugs...

sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c Outdated Show resolved Hide resolved
sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.h Outdated Show resolved Hide resolved
sys/net/gnrc/network_layer/ipv6/nib/nib.c Outdated Show resolved Hide resolved
sys/net/gnrc/network_layer/ipv6/nib/_nib-internal.c Outdated Show resolved Hide resolved
sys/net/gnrc/network_layer/ipv6/nib/nib.c Outdated Show resolved Hide resolved
Comment on lines 1464 to 1470
/** The Router Lifetime applies only to
the router's usefulness as a default router; it
does not apply to information contained in other
message fields or options. Options that need time
limits for their information include their own
lifetime fields.
@see [RFC4861]https://datatracker.ietf.org/doc/html/rfc4861#section-4.2 */
Copy link
Member

Choose a reason for hiding this comment

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

How does this comment relate to the fix below? Or should it even? Below you just seem to apply pointer arithmetics, which is a nice optimization, but the comparison has nothing to do with RA fields...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The comment expresses the opposite of the previous comment.
Offlink entries are _PFX, _DC, _FT.
Before, all associated prefixes were deleted. But prefixes have their own lifetime.
The _DC flag is cleared in _nib_drl_remove.
Assume any flag would be set in route->mode. That means it is present in some data structure.
If the mode is just set to _EMPTY and if _nib_offl_clear() simply memsets() the entry, it is not properly deleted.
An offlink entry must be deleted properly with (_nib_pl_remove, _nib_ft_remove, _nib_dc_remove).
I remember when I was debugging at that time I saw that the memset was brutally overwriting present entries.

sys/net/gnrc/network_layer/ipv6/nib/nib.c Show resolved Hide resolved
@benpicco
Copy link
Contributor

benpicco commented Feb 6, 2024

Are all the changes from this PR now merged or is there still something left?

@fabian18
Copy link
Contributor Author

fabian18 commented Feb 7, 2024

Not all, I am about to rebase this PR

@benpicco
Copy link
Contributor

@miri64 have your comments been addressed?

@miri64
Copy link
Member

miri64 commented Feb 20, 2024

I will have a look at this, and the other GNRC PRs, next week at Hack'n'ACK.

@miri64 miri64 dismissed their stale review February 27, 2024 18:23

Not agreeing with how the comments were addressed, but not blocking either.

@fabian18 fabian18 added this pull request to the merge queue Jun 10, 2024
Merged via the queue into RIOT-OS:master with commit d6d9d5f Jun 10, 2024
26 checks passed
@mguetschow mguetschow added this to the Release 2024.07 milestone Jun 11, 2024
@fabian18 fabian18 deleted the nib_rtr_fixes branch January 11, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking Area: sys Area: System Area: tests Area: tests and testing framework 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.

6 participants