network: default RequiredForOnline=false if ActivactionPolicy= not set to up
If ActivationPolicy= is set to down, always-down, or manual, then any matching link will delay boot (due to delaying network-online.target). If RequiredForOnline= wasn't explicitly set, then default it to false if ActivationPolicy= is down or manual. If ActivationPolicy=always-down, then force RequiredForOnline=no.
This commit is contained in:
@@ -229,6 +229,21 @@ int network_verify(Network *network) {
|
||||
if (network->ignore_carrier_loss < 0)
|
||||
network->ignore_carrier_loss = network->configure_without_carrier;
|
||||
|
||||
if (IN_SET(network->activation_policy, ACTIVATION_POLICY_DOWN, ACTIVATION_POLICY_ALWAYS_DOWN, ACTIVATION_POLICY_MANUAL)) {
|
||||
if (network->required_for_online < 0 ||
|
||||
(network->required_for_online == true && network->activation_policy == ACTIVATION_POLICY_ALWAYS_DOWN)) {
|
||||
log_debug("%s: Setting RequiredForOnline=no because ActivationPolicy=%s.", network->filename,
|
||||
activation_policy_to_string(network->activation_policy));
|
||||
network->required_for_online = false;
|
||||
} else if (network->required_for_online == true)
|
||||
log_warning("%s: RequiredForOnline=yes and ActivationPolicy=%s, "
|
||||
"this may cause a delay at boot.", network->filename,
|
||||
activation_policy_to_string(network->activation_policy));
|
||||
}
|
||||
|
||||
if (network->required_for_online < 0)
|
||||
network->required_for_online = true;
|
||||
|
||||
if (network->keep_configuration < 0)
|
||||
network->keep_configuration = KEEP_CONFIGURATION_NO;
|
||||
|
||||
@@ -303,7 +318,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
|
||||
.manager = manager,
|
||||
.n_ref = 1,
|
||||
|
||||
.required_for_online = true,
|
||||
.required_for_online = -1,
|
||||
.required_operstate_for_online = LINK_OPERSTATE_RANGE_DEFAULT,
|
||||
.activation_policy = _ACTIVATION_POLICY_INVALID,
|
||||
.arp = -1,
|
||||
@@ -1108,7 +1123,7 @@ int config_parse_required_for_online(
|
||||
assert(network);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
network->required_for_online = true;
|
||||
network->required_for_online = -1;
|
||||
network->required_operstate_for_online = LINK_OPERSTATE_RANGE_DEFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ struct Network {
|
||||
int allmulticast;
|
||||
int promiscuous;
|
||||
bool unmanaged;
|
||||
bool required_for_online; /* Is this network required to be considered online? */
|
||||
int required_for_online; /* Is this network required to be considered online? */
|
||||
LinkOperationalStateRange required_operstate_for_online;
|
||||
AddressFamily required_family_for_online;
|
||||
ActivationPolicy activation_policy;
|
||||
|
||||
Reference in New Issue
Block a user