From: Yu Watanabe Date: Fri, 13 May 2022 11:21:21 +0000 (+0900) Subject: network: split out link_is_ready_to_create_stacked_netdev() X-Git-Tag: v252-rc1~505^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=00117f8811da627d62c77ad8ec0589c007a72bc6;p=thirdparty%2Fsystemd.git network: split out link_is_ready_to_create_stacked_netdev() Preparation for later commits. --- diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c index f015168692b..7882cbc3645 100644 --- a/src/network/netdev/netdev.c +++ b/src/network/netdev/netdev.c @@ -604,24 +604,31 @@ static int stacked_netdev_create(NetDev *netdev, Link *link, Request *req) { return 0; } +static bool link_is_ready_to_create_stacked_netdev(Link *link) { + assert(link); + + if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) + return false; + + if (link->set_link_messages > 0) + return false; + + /* If stacked netdevs are created before the underlying interface being activated, then + * the activation policy for the netdevs are ignored. See issue #22593. */ + if (!link->activated) + return false; + + return true; +} + static int netdev_is_ready_to_create(NetDev *netdev, Link *link) { assert(netdev); if (netdev->state != NETDEV_STATE_LOADING) return false; - if (link) { - if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) - return false; - - if (link->set_link_messages > 0) - return false; - - /* If stacked netdevs are created before the underlying interface being activated, then - * the activation policy for the netdevs are ignored. See issue #22593. */ - if (!link->activated) - return false; - } + if (link && !link_is_ready_to_create_stacked_netdev(link)) + return false; if (NETDEV_VTABLE(netdev)->is_ready_to_create) return NETDEV_VTABLE(netdev)->is_ready_to_create(netdev, link);