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

link changes or nexthop deletion may lead to cache desync #418

Open
KanjiMonster opened this issue Jan 22, 2025 · 0 comments
Open

link changes or nexthop deletion may lead to cache desync #418

KanjiMonster opened this issue Jan 22, 2025 · 0 comments

Comments

@KanjiMonster
Copy link
Contributor

The kernel does not notify always if nexthops or routes are removed:

  • deleting a nexthop with id will silently remove all routes with this nexthop as destination
  • a link losing carrier (or set down) will silently remove all nexthops with id via this link, which may then trigger silent removal or routes

This means that when a link with a route with a nexthop with id goes down, all libnl sees is the link update that loses carrier, but none of the nexthop or route deletions.

I'm not sure how to properly handle this, though my first idea would be:

  • when we get a link update about a link losing carrier:

    • delete all nhs via that link
  • when we get a nh deletion:

    • delete all routes via that nh (matched on nh_id)

To make this work properly, we would need some way to send emulate RTM_DELNEXTHOP / RTM_DELROUTE events.

Unfortunately while removing the objects from the cache is "easy" as we can get to the appropriate cache via nl_cache_mngt_require_safe(), there is no easy way to notify about these changes, as there is currently no way to get from a cache to the associated manager.

My idea there would be to extend struct nl_cache_assoc with a link to the "owning" manager, so the is a way to get to the manager and then add a event_input() variant that directly takes a nl_object.

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

No branches or pull requests

1 participant