mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 00:38:07 +02:00
route-manager: restore shadowed gateway routes after direct routes
(cherry picked from commit ce2964c021)
This commit is contained in:
parent
292f0105b2
commit
0d0fa7ead6
1 changed files with 27 additions and 1 deletions
|
|
@ -715,6 +715,8 @@ next:
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
if (ipx_routes_changed) {
|
if (ipx_routes_changed) {
|
||||||
|
GArray *gateway_routes = NULL;
|
||||||
|
|
||||||
/* @effective_metrics_reverse contains the list of assigned metrics from the last
|
/* @effective_metrics_reverse contains the list of assigned metrics from the last
|
||||||
* sync. Walk through it and see what changes there are (and possibly restore a
|
* sync. Walk through it and see what changes there are (and possibly restore a
|
||||||
* shadowed route).
|
* shadowed route).
|
||||||
|
|
@ -754,7 +756,31 @@ next:
|
||||||
* or add any further routes then this. That means there might be some stale routes
|
* or add any further routes then this. That means there might be some stale routes
|
||||||
* (with a higher metric!). They will only be removed on the next sync of that other
|
* (with a higher metric!). They will only be removed on the next sync of that other
|
||||||
* ifindex. */
|
* ifindex. */
|
||||||
vtable->vt->route_add (priv->platform, 0, cur_ipx_route, *p_effective_metric);
|
|
||||||
|
if (!VTABLE_IS_DEVICE_ROUTE (vtable, cur_ipx_route)) {
|
||||||
|
/* the route to restore has a gateway. We can only restore the route
|
||||||
|
* when we also have a direct route to the gateway. There can be cases
|
||||||
|
* where the direct route is shadowed too, and we cannot restore the gateway
|
||||||
|
* route.
|
||||||
|
*
|
||||||
|
* Restore first the direct-routes, and gateway-routes afterwards.
|
||||||
|
* This can avoid some cases where we would fail to add the
|
||||||
|
* gateway route. */
|
||||||
|
if (!gateway_routes)
|
||||||
|
gateway_routes = g_array_new (FALSE, FALSE, sizeof (guint));
|
||||||
|
g_array_append_val (gateway_routes, i_ipx_routes);
|
||||||
|
} else
|
||||||
|
vtable->vt->route_add (priv->platform, 0, cur_ipx_route, *p_effective_metric);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gateway_routes) {
|
||||||
|
for (i = 0; i < gateway_routes->len; i++) {
|
||||||
|
i_ipx_routes = g_array_index (gateway_routes, guint, i);
|
||||||
|
vtable->vt->route_add (priv->platform, 0,
|
||||||
|
ipx_routes->index->entries[i_ipx_routes],
|
||||||
|
effective_metrics[i_ipx_routes]);
|
||||||
|
}
|
||||||
|
g_array_unref (gateway_routes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue