Skip to content

gk: improve the code of the FIB table#523

Merged
AltraMayor merged 6 commits intomasterfrom
fibv6
Aug 19, 2021
Merged

gk: improve the code of the FIB table#523
AltraMayor merged 6 commits intomasterfrom
fibv6

Conversation

@AltraMayor
Copy link
Owner

This pull request is a collection of patches to improve the code of gk/fib.c and 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.

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.
@AltraMayor
Copy link
Owner Author

Tested on XIA1 and in production.

@AltraMayor AltraMayor merged commit 5b4e3b9 into master Aug 19, 2021
@AltraMayor AltraMayor deleted the fibv6 branch August 19, 2021 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant