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

nl_l3: only route l3 neighs if we have a route for them #374

Merged
merged 1 commit into from
Mar 11, 2022

Conversation

KanjiMonster
Copy link
Contributor

Make sure we do not add host entries for l3 neighs for which we do not
have a route until we a route gets added, and drop the host entries
again when the route gets removed.

To do this, we need to start keeping track of all l3 neighs we currently
handle. To make this easy, use set, and reuse the nh_stub to store the
neighbor information.

To allow nh_stub to be used in a set, we need to make it comparable, so
implement the < operator for it.

Using this we can then determine the routability of a l3 neigh we add by
asking the kernel for the route to it, then checking if it has a nexthop
that exist on one of our interfaces.

Only if this is true, add a host route for it and add it to the set of
routed l3 neighbours, in all other cases add it to the set of unrouted
l3 neighbours.

Then when adding a route, add all currently unrouted l3 neighbors
matching this route, and conversely, when removing a route remove all
matching l3 neighbors that are currently routed.

Fixes l3 neighbours learned on an additional on-link staying reachable
after removing the on-link route.

Signed-off-by: Jonas Gorski jonas.gorski@bisdn.de

How Has This Been Tested?

Using the commands from #364 and verified that no host entries get added without a on-link route, and the host entry appearing and vanashing when adding and removing the on-link route.

Running a pipeline on ag5648 to check for regressions.

@KanjiMonster KanjiMonster marked this pull request as draft March 9, 2022 16:48
@KanjiMonster
Copy link
Contributor Author

IPv6 link-local will need some special handling, will fix that tomorrow.

@KanjiMonster KanjiMonster force-pushed the jogo_check_routability_of_l3_neighs branch from 02908fc to 4719213 Compare March 10, 2022 09:17
@KanjiMonster KanjiMonster marked this pull request as ready for review March 10, 2022 09:21
@KanjiMonster
Copy link
Contributor Author

Fixed IPv6 by ignoring IPv6 LL addresses; these should be unroutable anyway.

Make sure we do not add host entries for l3 neighs for which we do not
have a route until we a route gets added, and drop the host entries
again when the route gets removed.

To do this, we need to start keeping track of all l3 neighs we currently
handle. To make this easy, use a set, and reuse the nh_stub to store the
neighbor information. Due to IPv6 LL addresses being a bit more
complicated, and should never routable anyway, do not track them.

To allow nh_stub to be used in a set, we need to make it comparable, so
implement the < operator for it.

Using this we can then determine the routability of a l3 neigh we add by
asking the kernel for the route to it, then checking if it has a nexthop
that exist on one of our interfaces.

Only if this is true, add a host route for it and add it to the set of
routed l3 neighbours, in all other cases add it to the set of unrouted
l3 neighbours.

Then when adding a route, add all currently unrouted l3 neighbors
matching this route, and conversely, when removing a route remove all
matching l3 neighbors that are currently routed.

Fixes l3 neighbours learned on an additional on-link staying reachable
after removing the on-link route.

Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
@KanjiMonster KanjiMonster force-pushed the jogo_check_routability_of_l3_neighs branch from 4719213 to 0fdba0d Compare March 10, 2022 10:05
@rubensfig rubensfig merged commit d15a312 into master Mar 11, 2022
@rubensfig rubensfig deleted the jogo_check_routability_of_l3_neighs branch March 11, 2022 15:46
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.

ip neighbors are assumed and made routable regardless of actually having a route
2 participants