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

infra: fix bogus assert in nexthop_lookup #146

Merged
merged 1 commit into from
Jan 30, 2025
Merged

Conversation

rjarry
Copy link
Collaborator

@rjarry rjarry commented Jan 30, 2025

nexthop_lookup uses nh_pool_iter() with nh_pool_iter_cb to walk through all nexthops that are referenced by a route. Nexthops are only created and modified by the control thread but nexthop_lookup can be called by data plane workers as well (e.g. when receiving ARP and NDP packets).

There can be a race condition where a nexthop was allocated by the control thread, the address field has been set but the nexthop is not yet referenced by a route when a data plane thread calls nexthop_lookup().

Adjust the assert condition to ignore the address field contents when called from a data path thread.

Fixes: 7d6a8d6 ("ip: split rib and fib")

nexthop_lookup uses nh_pool_iter() with nh_pool_iter_cb to walk through
all nexthops that are referenced by a route. Nexthops are only created
and modified by the control thread but nexthop_lookup can be called by
data plane workers as well (e.g. when receiving ARP and NDP packets).

There can be a race condition where a nexthop was allocated by the
control thread, the address field has been set but the nexthop is not
yet referenced by a route when a data plane thread calls
nexthop_lookup().

Adjust the assert condition to ignore the address field contents when
called from a data path thread.

Fixes: 7d6a8d6 ("ip: split rib and fib")
Signed-off-by: Robin Jarry <[email protected]>
Copy link
Collaborator

@christophefontaine christophefontaine left a comment

Choose a reason for hiding this comment

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

Tested, fixes the bug when I start grout with gdb attached.

@rjarry rjarry merged commit aed6411 into DPDK:main Jan 30, 2025
4 checks passed
@rjarry rjarry deleted the assert branch January 30, 2025 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants