]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: route bound to a link requires the link is up
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 9 Mar 2026 02:46:01 +0000 (11:46 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 9 Mar 2026 02:46:14 +0000 (11:46 +0900)
We checked if the link is up only when configuring (explicit) nexthop,
but we did not checked that when configuring route which has (implicit)
nexthop.

Let's move the checks from nexthop_is_ready_to_configure() to
gateway_is_ready(), which is called for both implicit and explict
nexthops.

Fixes #40106.

src/network/networkd-nexthop.c
src/network/networkd-route-util.c

index 81eb85b4a06c10e7b8b20e4d540e178b09d6aa4b..0e453e159748a0dcc678d21ec29f2f83398baad3 100644 (file)
@@ -784,11 +784,6 @@ static bool nexthop_is_ready_to_configure(Link *link, const NextHop *nexthop) {
         if (nexthop_bound_to_link(nexthop)) {
                 assert(nexthop->ifindex == link->ifindex);
 
-                if (link->set_flags_messages > 0)
-                        return false;
-                if (!link_is_up(link))
-                        return false;
-
                 return gateway_is_ready(link, FLAGS_SET(nexthop->flags, RTNH_F_ONLINK), nexthop->family, &nexthop->gw.address);
         }
 
index 37ace2d335c60a2f7f611bc57cea2b83f229fbb7..3a7156fc4129fe38cc57a5b9b5d8692873248cad 100644 (file)
@@ -139,6 +139,12 @@ bool gateway_is_ready(Link *link, bool onlink, int family, const union in_addr_u
         assert(link);
         assert(link->manager);
 
+        if (link->set_flags_messages > 0)
+                return false;
+
+        if (!link_is_up(link))
+                return false;
+
         if (onlink)
                 return true;