From 39e68c03c8608dbf471194a17a9bddea812d88e0 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 18 Feb 2025 02:08:10 +0900 Subject: [PATCH] network/route: do not remove any foreign routes when KeepConfiguration=yes Without this change, only foreign routes with RTPROT_KERNEL, RTPROT_STATIC, RTPROT_DHCP, RTPROT_RA, and RTPROT_REDIRECT are kept, and foreign routes with other protocol e.g. RTPROT_BOOT are removed even if KeepConfiguration=yes. Fixes a regression in dd6d53a8dc58c5e6e310b09ba7f7a22600a87ba9 (v257). Fixes #36411. (cherry picked from commit 724faccf45b6933bb30c56cf99acf6373fffbc70) --- src/network/networkd-route.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index 0f3f79ec4fe..35c983b4a5b 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -1481,6 +1481,9 @@ int link_drop_routes(Link *link, bool only_static) { continue; if (route->source == NETWORK_CONFIG_SOURCE_FOREIGN && link->network) { + if (FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_YES)) + continue; + if (route->protocol == RTPROT_STATIC && FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_STATIC)) continue; -- 2.47.3