]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: route: link_drop_foreign_routes() must be called only for managed interfaces
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 11 Dec 2021 17:52:09 +0000 (02:52 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 16 Dec 2021 15:14:30 +0000 (00:14 +0900)
src/network/networkd-route.c

index bfd849abb969cb565ac2c5f95479d7d9cc128840..156476066a31397d9a066005ad9db0a4a04744ee 100644 (file)
@@ -893,6 +893,7 @@ int link_drop_foreign_routes(Link *link) {
 
         assert(link);
         assert(link->manager);
+        assert(link->network);
 
         SET_FOREACH(route, link->routes) {
                 /* do not touch routes managed by the kernel */
@@ -907,11 +908,11 @@ int link_drop_foreign_routes(Link *link) {
                 if (!route_exists(route))
                         continue;
 
-                if (route->protocol == RTPROT_STATIC && link->network &&
+                if (route->protocol == RTPROT_STATIC &&
                     FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_STATIC))
                         continue;
 
-                if (route->protocol == RTPROT_DHCP && link->network &&
+                if (route->protocol == RTPROT_DHCP &&
                     FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_DHCP))
                         continue;