diff options
author | Antonio Cardace <acardace@redhat.com> | 2020-07-06 12:44:54 +0200 |
---|---|---|
committer | Antonio Cardace <acardace@redhat.com> | 2020-07-08 15:10:36 +0200 |
commit | cd89026c5f4fa29c7bf46edb5b610ec37c18be78 (patch) | |
tree | f7e2bf912246fd5b5af40d664b13d3605dd18c2b | |
parent | 04878193f754d1f7708b70f4d146caa48d276873 (diff) | |
download | NetworkManager-cd89026c5f4fa29c7bf46edb5b610ec37c18be78.tar.gz |
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
-rw-r--r-- | src/nm-ip6-config.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c index d772d6a255..404b201f87 100644 --- a/src/nm-ip6-config.c +++ b/src/nm-ip6-config.c @@ -456,6 +456,24 @@ nm_ip6_config_update_routes_metric (NMIP6Config *self, gint64 metric) 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 nm_ip6_config_add_dependent_routes (NMIP6Config *self, 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. */ + /* Pre-generate multicast route */ + _add_multicast_route6 (self, ifindex); + nm_ip_config_iter_ip6_address_for_each (&iter, self, &my_addr) { NMPlatformIP6Route *route; gboolean has_peer; |