Merge pull request #21655 from yuwata/network-creating-enslaving-netdev-cleanups
network: cleanups for creating or enslaving netdevs
This commit is contained in:
@@ -612,26 +612,20 @@ int netdev_join(NetDev *netdev, Link *link, link_netlink_message_handler_t callb
|
||||
}
|
||||
|
||||
static bool netdev_is_ready_to_create(NetDev *netdev, Link *link) {
|
||||
Request req;
|
||||
|
||||
assert(netdev);
|
||||
assert(link);
|
||||
|
||||
if (netdev->state != NETDEV_STATE_LOADING)
|
||||
return false;
|
||||
if (!IN_SET(link->state, LINK_STATE_INITIALIZED, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
|
||||
|
||||
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
|
||||
return false;
|
||||
|
||||
if (netdev_get_create_type(netdev) == NETDEV_CREATE_AFTER_CONFIGURED &&
|
||||
link->state != LINK_STATE_CONFIGURED)
|
||||
return false;
|
||||
|
||||
req = (Request) {
|
||||
.link = link,
|
||||
.type = REQUEST_TYPE_SET_LINK,
|
||||
.set_link_operation_ptr = INT_TO_PTR(SET_LINK_MTU),
|
||||
};
|
||||
|
||||
if (ordered_set_contains(link->manager->request_queue, &req))
|
||||
if (link->set_link_messages > 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -172,9 +172,6 @@ bool link_is_ready_to_configure(Link *link, bool allow_unmanaged) {
|
||||
if (link->set_link_messages > 0)
|
||||
return false;
|
||||
|
||||
if (!link->stacked_netdevs_created)
|
||||
return false;
|
||||
|
||||
if (!link->activated)
|
||||
return false;
|
||||
|
||||
@@ -441,6 +438,9 @@ void link_check_ready(Link *link) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!link->stacked_netdevs_created)
|
||||
return (void) log_link_debug(link, "%s(): stacked netdevs are not created.", __func__);
|
||||
|
||||
if (!link->static_addresses_configured)
|
||||
return (void) log_link_debug(link, "%s(): static addresses are not configured.", __func__);
|
||||
|
||||
|
||||
@@ -568,12 +568,19 @@ static bool link_is_ready_to_call_set_link(Request *req) {
|
||||
break;
|
||||
case SET_LINK_MASTER: {
|
||||
uint32_t m = 0;
|
||||
Request req_mac = {
|
||||
.link = link,
|
||||
.type = REQUEST_TYPE_SET_LINK,
|
||||
.set_link_operation_ptr = INT_TO_PTR(SET_LINK_MAC),
|
||||
};
|
||||
|
||||
if (link->network->batadv) {
|
||||
if (!netdev_is_ready(link->network->batadv))
|
||||
return false;
|
||||
m = link->network->batadv->ifindex;
|
||||
} else if (link->network->bond) {
|
||||
if (ordered_set_contains(link->manager->request_queue, &req_mac))
|
||||
return false;
|
||||
if (!netdev_is_ready(link->network->bond))
|
||||
return false;
|
||||
m = link->network->bond->ifindex;
|
||||
@@ -589,6 +596,8 @@ static bool link_is_ready_to_call_set_link(Request *req) {
|
||||
}
|
||||
}
|
||||
} else if (link->network->bridge) {
|
||||
if (ordered_set_contains(link->manager->request_queue, &req_mac))
|
||||
return false;
|
||||
if (!netdev_is_ready(link->network->bridge))
|
||||
return false;
|
||||
m = link->network->bridge->ifindex;
|
||||
|
||||
Reference in New Issue
Block a user