From 9ecc27f6d33f306c0e814bedef293eef783f27f1 Mon Sep 17 00:00:00 2001 From: Antonio Cardace Date: Wed, 8 Jul 2020 12:27:46 +0200 Subject: [PATCH] platform: do not prune kernel added routes IPv6 routes having metric 0 and routes having rt_source == kernel are entirely managed by kernel, NM should not try to remove them. https://bugzilla.redhat.com/show_bug.cgi?id=1821787 --- src/platform/nm-platform.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 2181ca6f6f..08822b1cc2 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -4230,9 +4230,18 @@ nm_platform_ip_route_get_prune_list (NMPlatform *self, } else if (route_table_sync == NM_IP_ROUTE_TABLE_SYNC_MODE_MAIN) { if (!nm_platform_route_table_is_main (NMP_OBJECT_CAST_IP_ROUTE (obj)->table_coerced)) continue; - } else + } else { nm_assert (route_table_sync == NM_IP_ROUTE_TABLE_SYNC_MODE_ALL); + /* IPv6 routes having metric 0 and routes having rt_source == NM_IP_CONFIG_SOURCE_RTPROT_KERNEL + * are entirely managed by kernel, let's not touch them */ + if (addr_family == AF_INET6 && NMP_OBJECT_CAST_IP6_ROUTE (obj)->metric == 0) + continue; + if ( nm_platform_route_table_uncoerce (NMP_OBJECT_CAST_IP_ROUTE (obj)->table_coerced, TRUE) == RT_TABLE_LOCAL + && NMP_OBJECT_CAST_IP_ROUTE (obj)->rt_source == NM_IP_CONFIG_SOURCE_RTPROT_KERNEL) + continue; + } + g_ptr_array_add (routes_prune, (gpointer) nmp_object_ref (obj)); }