From 8031e5ca8dd8a7967c705a2298ab3ccbee661253 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 18 May 2021 12:20:46 +0900 Subject: [PATCH] network: nexthop: IFF_UP flag is required for nexthops which attached to a link --- src/network/networkd-nexthop.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c index ed0a2033021..91f0eb30323 100644 --- a/src/network/networkd-nexthop.c +++ b/src/network/networkd-nexthop.c @@ -2,6 +2,7 @@ * Copyright © 2019 VMware, Inc. */ +#include #include #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; -- 2.47.3