]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/route: use nexthop_is_ready() 30775/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Jan 2024 20:30:43 +0000 (05:30 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Jan 2024 20:33:49 +0000 (05:33 +0900)
src/network/networkd-route.c

index 72dbf9ed0675179315cf2add7e1fa2eaf2ae04a5..abaea4e6c3f61fc7602e6acb08ba79e05b3c86d7 100644 (file)
@@ -1277,20 +1277,14 @@ static int route_is_ready_to_configure(const Route *route, Link *link) {
                 struct nexthop_grp *nhg;
                 NextHop *nh;
 
-                if (nexthop_get_by_id(link->manager, route->nexthop_id, &nh) < 0)
-                        return false;
-
-                if (!nexthop_exists(nh))
-                        return false;
+                r = nexthop_is_ready(link->manager, route->nexthop_id, &nh);
+                if (r <= 0)
+                        return r;
 
                 HASHMAP_FOREACH(nhg, nh->group) {
-                        NextHop *g;
-
-                        if (nexthop_get_by_id(link->manager, nhg->id, &g) < 0)
-                                return false;
-
-                        if (!nexthop_exists(g))
-                                return false;
+                        r = nexthop_is_ready(link->manager, nhg->id, NULL);
+                        if (r <= 0)
+                                return r;
                 }
         }