merge: branch 'ff/fix_l3cfg_onlink'

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1510
This commit is contained in:
Fernando Fernandez Mancera 2023-01-26 11:11:51 +01:00
commit 8e17e0c0bd
2 changed files with 2 additions and 44 deletions

View file

@ -2408,10 +2408,7 @@ nm_l3_config_data_cmp_full(const NML3ConfigData *a,
/*****************************************************************************/
static const NMPObject *
_data_get_direct_route_for_host(const NML3ConfigData *self,
int addr_family,
gconstpointer host,
guint32 route_table)
_data_get_direct_route_for_host(const NML3ConfigData *self, int addr_family, gconstpointer host)
{
const int IS_IPv4 = NM_IS_IPv4(addr_family);
const NMPObject *best_route_obj = NULL;
@ -2439,9 +2436,6 @@ _data_get_direct_route_for_host(const NML3ConfigData *self,
if (best_route && best_route->rx.plen > item->rx.plen)
continue;
if (nm_platform_route_table_uncoerce(item->rx.table_coerced, TRUE) != route_table)
continue;
if (!nm_ip_addr_same_prefix(addr_family, host, item->rx.network_ptr, item->rx.plen))
continue;
@ -2569,12 +2563,7 @@ nm_l3_config_data_add_dependent_onlink_routes(NML3ConfigData *self, int addr_fam
if (nm_ip_addr_is_null(addr_family, p_gateway))
continue;
if (!NM_PLATFORM_IP_ROUTE_IS_DEFAULT(route_src)
|| _data_get_direct_route_for_host(
self,
addr_family,
p_gateway,
nm_platform_route_table_uncoerce(route_src->rx.table_coerced, TRUE)))
if (_data_get_direct_route_for_host(self, addr_family, p_gateway))
continue;
new_route = nmp_object_clone(obj_src, FALSE);

View file

@ -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);
}
}