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:
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.
The kernel does not notify always if nexthops or routes are removed:
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:
when we get a nh deletion:
To make this work properly, we would need some way to send emulate
RTM_DELNEXTHOP/RTM_DELROUTEevents.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_assocwith a link to the "owning" manager, so the is a way to get to the manager and then add aevent_input()variant that directly takes anl_object.