mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 12:34:55 +00:00
device: reorder checks in check_connection_available()
No change in behavior. Just reorder, so that the checks that can be reviewed in place are handled first.
This commit is contained in:
parent
b3b8323499
commit
42f20a4edf
|
@ -15324,10 +15324,7 @@ check_connection_available(NMDevice *self,
|
|||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
||||
|
||||
/* Connections which require a network connection are not available when
|
||||
* the device has no carrier, even with ignore-carrer=TRUE.
|
||||
*/
|
||||
if (priv->carrier || !connection_requires_carrier(connection))
|
||||
if (priv->carrier)
|
||||
return TRUE;
|
||||
|
||||
if (NM_FLAGS_HAS(flags, _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_WAITING_CARRIER)
|
||||
|
@ -15339,12 +15336,6 @@ check_connection_available(NMDevice *self,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* master types are always available even without carrier.
|
||||
* Making connection non-available would un-enslave slaves which
|
||||
* is not desired. */
|
||||
if (nm_device_is_master(self))
|
||||
return TRUE;
|
||||
|
||||
if (!priv->up) {
|
||||
/* If the device is !IFF_UP it also has no carrier. But we assume that if we
|
||||
* would start activating the device (and thereby set the device IFF_UP),
|
||||
|
@ -15354,6 +15345,18 @@ check_connection_available(NMDevice *self,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
if (!connection_requires_carrier(connection)) {
|
||||
/* Connections that don't require carrier are available. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (nm_device_is_master(self)) {
|
||||
/* master types are always available even without carrier.
|
||||
* Making connection non-available would un-enslave slaves which
|
||||
* is not desired. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
nm_utils_error_set_literal(error,
|
||||
NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
|
||||
"device has no carrier");
|
||||
|
|
Loading…
Reference in a new issue