mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 22:20:19 +01:00
route-manager: add routine to query route shadowing for a link
If a route is shadowed by another route to the same network it's a good indication we're multihoming and want to disable the Strict RP filtering.
This commit is contained in:
parent
8d4570d28d
commit
75faf5bb77
2 changed files with 28 additions and 0 deletions
|
|
@ -967,6 +967,33 @@ nm_route_manager_route_flush (NMRouteManager *self, int ifindex)
|
|||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_route_manager_ip4_routes_shadowed:
|
||||
* @ifindex: Interface index
|
||||
*
|
||||
* Returns: %TRUE if some other link has a route to the same destination
|
||||
* with a lower metric.
|
||||
*/
|
||||
gboolean
|
||||
nm_route_manager_ip4_routes_shadowed (NMRouteManager *self, int ifindex)
|
||||
{
|
||||
NMRouteManagerPrivate *priv = NM_ROUTE_MANAGER_GET_PRIVATE (self);
|
||||
RouteIndex *index = priv->ip4_routes.index;
|
||||
const NMPlatformIP4Route *route;
|
||||
guint i;
|
||||
|
||||
for (i = 1; i < index->len; i++) {
|
||||
route = (const NMPlatformIP4Route *) index->entries[i];
|
||||
|
||||
if (route->ifindex != ifindex)
|
||||
continue;
|
||||
if (_v4_route_dest_cmp (route, (const NMPlatformIP4Route *) index->entries[i - 1]) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ gboolean nm_route_manager_ip4_route_sync (NMRouteManager *self, int ifindex, con
|
|||
gboolean nm_route_manager_ip6_route_sync (NMRouteManager *self, int ifindex, const GArray *known_routes, gboolean ignore_kernel_routes, gboolean full_sync);
|
||||
gboolean nm_route_manager_route_flush (NMRouteManager *self, int ifindex);
|
||||
|
||||
gboolean nm_route_manager_ip4_routes_shadowed (NMRouteManager *self, int ifindex);
|
||||
void nm_route_manager_ip4_route_register_device_route_purge_list (NMRouteManager *self, GArray *device_route_purge_list);
|
||||
|
||||
NMRouteManager *nm_route_manager_get (void);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue