From d27a164d09aca0649100f83056df3c2083a50e17 Mon Sep 17 00:00:00 2001 From: Fernando Fernandez Mancera Date: Tue, 24 Jan 2023 15:41:50 +0100 Subject: [PATCH] Revert "nm-netns: add onlink routes for ECMP routes" ECMP IPv4 route nexthops requires an onlink route but we should trust l3cfg when generating and managing such routes. This reverts commit 737cb5d424e397901a5ad979907a084f770dd8d4. (cherry picked from commit cbf70b4dca4ff520ab33c1b944f95fc52eae52e1) --- src/core/nm-netns.c | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/src/core/nm-netns.c b/src/core/nm-netns.c index b5c150c0f..ca9f66c05 100644 --- a/src/core/nm-netns.c +++ b/src/core/nm-netns.c @@ -780,8 +780,6 @@ _netns_ip_route_ecmp_update_mh(NMNetns *self, const NMPObject *obj = mhrts_add->pdata[i]; nm_auto_nmpobj const NMPObject *obj_old = NULL; gpointer unused; - const NMPlatformIP4Route *route_src; - guint j; if (g_hash_table_steal_extended(priv->ecmp_routes, obj, @@ -794,35 +792,6 @@ _netns_ip_route_ecmp_update_mh(NMNetns *self, if (!g_hash_table_add(priv->ecmp_routes, (gpointer) nmp_object_ref(obj))) nm_assert_not_reached(); - /* for each nexthop we need to configure the onlink route for the gateway */ - route_src = NMP_OBJECT_CAST_IP4_ROUTE(obj); - for (j = 0; j < route_src->n_nexthops; j++) { - NMPObject *new_onlink_obj; - NMPlatformIP4Route *new_onlink_route; - in_addr_t gateway; - int ifindex; - - new_onlink_obj = nmp_object_clone(obj, TRUE); - new_onlink_route = NMP_OBJECT_CAST_IP4_ROUTE(new_onlink_obj); - if (j == 0) { - gateway = route_src->gateway; - ifindex = route_src->ifindex; - } else { - gateway = obj->_ip4_route.extra_nexthops[j - 1].gateway; - ifindex = obj->_ip4_route.extra_nexthops[j - 1].ifindex; - } - - new_onlink_route->network = gateway; - new_onlink_route->plen = 32; - new_onlink_route->gateway = 0; - new_onlink_route->ifindex = ifindex; - new_onlink_route->weight = 0; - new_onlink_route->n_nexthops = 0; - - /* we configure the onlink route and l3cfg will take the ownership and remove it if not needed */ - nm_platform_ip_route_add(priv->platform, NMP_NLM_FLAG_APPEND, new_onlink_obj); - } - nm_platform_ip_route_add(priv->platform, NMP_NLM_FLAG_APPEND, obj); } }