1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

network: wait for QDiscs to be configured

This commit is contained in:
Yu Watanabe 2019-10-30 00:19:34 +09:00
parent 0f5bd7fe24
commit 4ecdcb07c9
3 changed files with 36 additions and 4 deletions

View File

@ -1095,6 +1095,9 @@ void link_check_ready(Link *link) {
if (!link->routing_policy_rules_configured)
return;
if (!link->qdiscs_configured)
return;
if (link_has_carrier(link) || !link->network->configure_without_carrier) {
if (link_ipv4ll_enabled(link, ADDRESS_FAMILY_IPV4) && !link->ipv4ll_address)
@ -2581,21 +2584,42 @@ static int link_drop_config(Link *link) {
return 0;
}
static int link_configure(Link *link) {
static int link_configure_qdiscs(Link *link) {
QDiscs *qdisc;
Iterator i;
int r;
link->qdiscs_configured = false;
link->qdisc_messages = 0;
ORDERED_HASHMAP_FOREACH(qdisc, link->network->qdiscs_by_section, i) {
r = qdisc_configure(link, qdisc);
if (r < 0)
return r;
}
if (link->qdisc_messages == 0)
link->qdiscs_configured = true;
else
log_link_debug(link, "Configuring QDiscs");
return 0;
}
static int link_configure(Link *link) {
int r;
assert(link);
assert(link->network);
assert(link->state == LINK_STATE_INITIALIZED);
r = link_configure_qdiscs(link);
if (r < 0)
return r;
if (link->iftype == ARPHRD_CAN)
return link_configure_can(link);
ORDERED_HASHMAP_FOREACH(qdisc, link->network->qdiscs_by_section, i)
(void) qdisc_configure(link, qdisc);
/* Drop foreign config, but ignore loopback or critical devices.
* We do not want to remove loopback address or addresses used for root NFS. */
if (!(link->flags & IFF_LOOPBACK) &&

View File

@ -114,6 +114,7 @@ typedef struct Link {
bool static_routes_ready:1;
bool static_nexthops_configured:1;
bool routing_policy_rules_configured:1;
bool qdiscs_configured:1;
bool setting_mtu:1;
LIST_HEAD(Address, pool_addresses);

View File

@ -101,9 +101,16 @@ static int qdisc_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error_errno(link, r, "Could not set QDisc: %m");
link_enter_failed(link);
return 1;
}
if (link->route_messages == 0) {
log_link_debug(link, "QDiscs configured");
link->qdiscs_configured = true;
link_check_ready(link);
}
return 1;
}