core: add dependent multicast route configured by kernel for IPv6

Pre-generate the device multicast route in the local table that are configured
by kernel when an ipv6-address is assigned to an interface.

This helps NM taking into account routes that are not to be deleted
when a connection is reapplied on an interface.

https://bugzilla.redhat.com/show_bug.cgi?id=1821787
This commit is contained in:
Antonio Cardace
2020-07-06 12:44:54 +02:00
parent 04878193f7
commit cd89026c5f

View File

@@ -456,6 +456,24 @@ nm_ip6_config_update_routes_metric (NMIP6Config *self, gint64 metric)
g_object_thaw_notify (G_OBJECT (self)); g_object_thaw_notify (G_OBJECT (self));
} }
static void
_add_multicast_route6 (NMIP6Config *self, int ifindex)
{
nm_auto_nmpobj NMPObject *r = NULL;
NMPlatformIP6Route *route;
r = nmp_object_new (NMP_OBJECT_TYPE_IP6_ROUTE, NULL);
route = NMP_OBJECT_CAST_IP6_ROUTE (r);
route->ifindex = ifindex;
route->network.s6_addr[0] = 0xffu;
route->plen = 8;
route->table_coerced = nm_platform_route_table_coerce (RT_TABLE_LOCAL);
route->type_coerced = nm_platform_route_type_coerce (RTN_UNICAST);
route->metric = 256;
_add_route (self, r, NULL, NULL);
}
void void
nm_ip6_config_add_dependent_routes (NMIP6Config *self, nm_ip6_config_add_dependent_routes (NMIP6Config *self,
guint32 route_table, guint32 route_table,
@@ -476,6 +494,9 @@ nm_ip6_config_add_dependent_routes (NMIP6Config *self,
* *
* For manually added IPv6 routes, add the device routes explicitly. */ * For manually added IPv6 routes, add the device routes explicitly. */
/* Pre-generate multicast route */
_add_multicast_route6 (self, ifindex);
nm_ip_config_iter_ip6_address_for_each (&iter, self, &my_addr) { nm_ip_config_iter_ip6_address_for_each (&iter, self, &my_addr) {
NMPlatformIP6Route *route; NMPlatformIP6Route *route;
gboolean has_peer; gboolean has_peer;