]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: nexthop: IFF_UP flag is required for nexthops which attached to a link
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 18 May 2021 03:20:46 +0000 (12:20 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 21 May 2021 19:56:46 +0000 (04:56 +0900)
src/network/networkd-nexthop.c

index ed0a2033021a6fed89e4781396463d58f70c466d..91f0eb303232bd67793784648768d53469d791c6 100644 (file)
@@ -2,6 +2,7 @@
  * Copyright © 2019 VMware, Inc.
  */
 
+#include <net/if.h>
 #include <linux/nexthop.h>
 
 #include "alloc-util.h"
@@ -695,12 +696,21 @@ static bool nexthop_is_ready_to_configure(Link *link, const NextHop *nexthop) {
         assert(link);
         assert(nexthop);
 
+        if (!link_is_ready_to_configure(link, false))
+                return false;
+
         if (nexthop->blackhole) {
                 if (link->manager->nexthop_remove_messages > 0)
                         return false;
         } else {
                 Link *l;
 
+                /* TODO: fdb nexthop does not require IFF_UP. The condition below needs to be updated
+                 * when fdb nexthop support is added. See rtm_to_nh_config() in net/ipv4/nexthop.c of
+                 * kernel. */
+                if (!FLAGS_SET(link->flags, IFF_UP))
+                        return false;
+
                 HASHMAP_FOREACH(l, link->manager->links) {
                         if (l->address_remove_messages > 0)
                                 return false;
@@ -739,9 +749,6 @@ int request_process_nexthop(Request *req) {
         assert(req->nexthop);
         assert(req->type == REQUEST_TYPE_NEXTHOP);
 
-        if (!link_is_ready_to_configure(req->link, false))
-                return 0;
-
         if (!nexthop_is_ready_to_configure(req->link, req->nexthop))
                 return 0;