]> 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)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 18 Feb 2025 14:01:53 +0000 (23:01 +0900)
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.

src/network/networkd-route.c

index e41b4c31be1095295f1758499e6de0a83f79c0f4..9a05bf7c5cdabd2f1a564cb12de0af57f2ebbf9f 100644 (file)
@@ -1485,6 +1485,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;