]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/network/networkd-address.c
network/route: manage all routes by Manager object
[thirdparty/systemd.git] / src / network / networkd-address.c
index 631c64ec06e85db2971e86fd474aacffc9ef0228..c86e6d1a0f9431eb63381cb019c64ac3e9ab8670 100644 (file)
@@ -1208,6 +1208,7 @@ bool link_address_is_dynamic(const Link *link, const Address *address) {
         Route *route;
 
         assert(link);
+        assert(link->manager);
         assert(address);
 
         if (address->lifetime_preferred_usec != USEC_INFINITY)
@@ -1216,7 +1217,7 @@ bool link_address_is_dynamic(const Link *link, const Address *address) {
         /* Even when the address is leased from a DHCP server, networkd assign the address
          * without lifetime when KeepConfiguration=dhcp. So, let's check that we have
          * corresponding routes with RTPROT_DHCP. */
-        SET_FOREACH(route, link->routes) {
+        SET_FOREACH(route, link->manager->routes) {
                 if (route->source != NETWORK_CONFIG_SOURCE_FOREIGN)
                         continue;
 
@@ -1227,6 +1228,9 @@ bool link_address_is_dynamic(const Link *link, const Address *address) {
                 if (route->protocol != RTPROT_DHCP)
                         continue;
 
+                if (route->nexthop.ifindex != link->ifindex)
+                        continue;
+
                 if (address->family != route->family)
                         continue;