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:
@@ -15324,10 +15324,7 @@ check_connection_available(NMDevice *self,
|
|||||||
{
|
{
|
||||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
||||||
|
|
||||||
/* Connections which require a network connection are not available when
|
if (priv->carrier)
|
||||||
* the device has no carrier, even with ignore-carrer=TRUE.
|
|
||||||
*/
|
|
||||||
if (priv->carrier || !connection_requires_carrier(connection))
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (NM_FLAGS_HAS(flags, _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST_WAITING_CARRIER)
|
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;
|
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 (!priv->up) {
|
||||||
/* If the device is !IFF_UP it also has no carrier. But we assume that if we
|
/* 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),
|
* would start activating the device (and thereby set the device IFF_UP),
|
||||||
@@ -15354,6 +15345,18 @@ check_connection_available(NMDevice *self,
|
|||||||
return TRUE;
|
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_set_literal(error,
|
||||||
NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
|
NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
|
||||||
"device has no carrier");
|
"device has no carrier");
|
||||||
|
Reference in New Issue
Block a user