gk: improve the code of the FIB table#523
Merged
AltraMayor merged 6 commits intomasterfrom Aug 19, 2021
Merged
Conversation
Improve log entries of find_fib_entry_for_neighbor_locked().
__get_empty_fib_id() is not meant to be called directly, but a construct to simplify get_empty_fib_id(). This patch simplifies __get_empty_fib_id() by making it blind to IPv4 vs IPv6 and error messages.
All callers of get_empty_fib_id() use the returned FIB ID to find the corresponding FIB entry, but to do that they have to find the version of IP again. Since get_empty_fib_id() already tests for the version of IP, this patch simplifies the callers by returning the FIB entry as well.
This patch is just staging the code for the next patch.
Currently, only grantor FIB entries can be updated in place. But the code was not making sure that it was updating a grantor FIB entry before updating an existing entry. Thus, the operation would corrupt memory if the passed prefix were to an existing FIB entry of a different type.
Owner
Author
|
Tested on XIA1 and in production. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request is a collection of patches to improve the code of
gk/fib.cand a patch to check the type of a FIB entry before updating it. This last patch avoids memory corruption memory when a wrong prefix is passed to the FIB.