]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/route: do not remove any foreign routes when KeepConfiguration=yes
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 17 Feb 2025 17:08:10 +0000 (02:08 +0900)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 22 Feb 2025 11:15:12 +0000 (12:15 +0100)
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

index 0f3f79ec4fe099a93cb1a78733dda9b8404cd327..35c983b4a5b53a86a1d642cf758c9a76fc07286d 100644 (file)
@@ -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;