summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-01-20 21:06:31 +0100
committerThomas Haller <thaller@redhat.com>2015-02-24 11:49:04 +0100
commit37ebeccaa7247664d69cdfbdb20861bf78f8d72d (patch)
tree369d636d5a432afed71da419746e1140ee45dfd9
parent52dbb2398a89134fe2c0bc19d032b985c7464c08 (diff)
downloadNetworkManager-37ebeccaa7247664d69cdfbdb20861bf78f8d72d.tar.gz
device: implement flag NM_DEVICE_CHECK_DEV_AVAILABLE_IGNORE_CARRIER for is_available()
-rw-r--r--src/devices/nm-device.c8
-rw-r--r--src/devices/nm-device.h2
2 files changed, 9 insertions, 1 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 79befb36db..c4ec949aee 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -1738,7 +1738,13 @@ is_available (NMDevice *self, NMDeviceCheckDevAvailableFlags flags)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
- return priv->carrier || priv->ignore_carrier;
+ if (priv->carrier || priv->ignore_carrier)
+ return TRUE;
+
+ if (NM_FLAGS_HAS (flags, NM_DEVICE_CHECK_DEV_AVAILABLE_IGNORE_CARRIER))
+ return TRUE;
+
+ return FALSE;
}
/**
diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h
index 4c2d4f8c53..a863571f29 100644
--- a/src/devices/nm-device.h
+++ b/src/devices/nm-device.h
@@ -93,6 +93,7 @@ typedef enum NMActStageReturn NMActStageReturn;
* not available if it would be available otherwise. */
typedef enum {
NM_DEVICE_CHECK_CON_AVAILABLE_NONE = 0,
+
NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST = (1L << 0),
__NM_DEVICE_CHECK_CON_AVAILABLE_ALL,
@@ -107,6 +108,7 @@ struct _NMDevice {
* a device appear more available. It can never make a device less available. */
typedef enum {
NM_DEVICE_CHECK_DEV_AVAILABLE_NONE = 0,
+ NM_DEVICE_CHECK_DEV_AVAILABLE_IGNORE_CARRIER = (1L << 0),
__NM_DEVICE_CHECK_DEV_AVAILABLE_ALL,
NM_DEVICE_CHECK_DEV_AVAILABLE_ALL = (((__NM_DEVICE_CHECK_DEV_AVAILABLE_ALL - 1) << 1) - 1),