summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-07-17 15:46:12 -0400
committerDan Winship <danw@redhat.com>2015-01-26 12:32:13 -0500
commitd439601ae0bd8813c0ccad57982bad6a29d3df65 (patch)
tree9087bd96ab7c0f5d34f77c704aacdebe8a8ac6bc
parentbdd24f483aae02459caef00120d65a1459d1573e (diff)
downloadNetworkManager-danw/no-default-unmanaged.tar.gz
core: drop "default-unmanaged" devicesdanw/no-default-unmanaged
"default-unmanaged" was added for NMDeviceGeneric, so that they could be unmanaged by default, but still activatable under the correct arcane circumstances. However, NMDeviceGeneric will only allow itself connections with type "generic" to be activated on it anyway, so there is no chance of a device being accidentally activated on it, so all of the unmanaged-default handling just complicates the code for no reason.
-rw-r--r--src/devices/nm-device-generic.c1
-rw-r--r--src/devices/nm-device.c80
-rw-r--r--src/devices/nm-device.h2
-rw-r--r--src/nm-manager.c7
4 files changed, 6 insertions, 84 deletions
diff --git a/src/devices/nm-device-generic.c b/src/devices/nm-device-generic.c
index f103ef8303..ba6530ab64 100644
--- a/src/devices/nm-device-generic.c
+++ b/src/devices/nm-device-generic.c
@@ -104,7 +104,6 @@ nm_device_generic_new (NMPlatformLink *platform_device)
static void
nm_device_generic_init (NMDeviceGeneric *self)
{
- nm_device_set_initial_unmanaged_flag (NM_DEVICE (self), NM_UNMANAGED_DEFAULT, TRUE);
}
static void
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 3bb65c487b..3fa3d2e408 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -338,8 +338,6 @@ static gboolean addrconf6_start_with_link_ready (NMDevice *self);
static gboolean dhcp6_start_with_link_ready (NMDevice *self, NMConnection *connection);
static NMActStageReturn linklocal6_start (NMDevice *self);
-static gboolean nm_device_get_default_unmanaged (NMDevice *self);
-
static void _set_state_full (NMDevice *self,
NMDeviceState state,
NMDeviceStateReason reason,
@@ -1816,16 +1814,8 @@ nm_device_set_autoconnect (NMDevice *self, gboolean autoconnect)
if (priv->autoconnect == autoconnect)
return;
- if (autoconnect) {
- /* Default-unmanaged devices never autoconnect */
- if (!nm_device_get_default_unmanaged (self)) {
- priv->autoconnect = TRUE;
- g_object_notify (G_OBJECT (self), NM_DEVICE_AUTOCONNECT);
- }
- } else {
- priv->autoconnect = FALSE;
- g_object_notify (G_OBJECT (self), NM_DEVICE_AUTOCONNECT);
- }
+ priv->autoconnect = autoconnect;
+ g_object_notify (G_OBJECT (self), NM_DEVICE_AUTOCONNECT);
}
static gboolean
@@ -5709,13 +5699,6 @@ _device_activate (NMDevice *self, NMActRequest *req)
delete_on_deactivate_unschedule (self);
- /* Move default unmanaged devices to DISCONNECTED state here */
- if (nm_device_get_default_unmanaged (self) && priv->state == NM_DEVICE_STATE_UNMANAGED) {
- nm_device_state_changed (self,
- NM_DEVICE_STATE_DISCONNECTED,
- NM_DEVICE_STATE_REASON_NOW_MANAGED);
- }
-
/* note: don't notify D-Bus of the new AC here, but do it later when
* changing state to PREPARE so that the two properties change together.
*/
@@ -6737,23 +6720,9 @@ nm_device_queued_ip_config_change_clear (NMDevice *self)
gboolean
nm_device_get_managed (NMDevice *self)
{
- NMDevicePrivate *priv;
- gboolean managed;
-
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
- priv = NM_DEVICE_GET_PRIVATE (self);
-
- /* Return the composite of all managed flags. However, if the device
- * is a default-unmanaged device, and would be managed except for the
- * default-unmanaged flag (eg, only NM_UNMANAGED_DEFAULT is set) then
- * the device is managed whenever it's not in the UNMANAGED state.
- */
- managed = !(priv->unmanaged_flags & ~NM_UNMANAGED_DEFAULT);
- if (managed && (priv->unmanaged_flags & NM_UNMANAGED_DEFAULT))
- managed = (priv->state > NM_DEVICE_STATE_UNMANAGED);
-
- return managed;
+ return NM_DEVICE_GET_PRIVATE (self)->unmanaged_flags == 0;
}
/**
@@ -6768,18 +6737,6 @@ nm_device_get_unmanaged_flag (NMDevice *self, NMUnmanagedFlags flag)
return NM_FLAGS_ANY (NM_DEVICE_GET_PRIVATE (self)->unmanaged_flags, flag);
}
-/**
- * nm_device_get_default_unmanaged():
- * @self: the #NMDevice
- *
- * Returns: %TRUE if the device is by default unmanaged
- */
-static gboolean
-nm_device_get_default_unmanaged (NMDevice *self)
-{
- return nm_device_get_unmanaged_flag (self, NM_UNMANAGED_DEFAULT);
-}
-
void
nm_device_set_unmanaged (NMDevice *self,
NMUnmanagedFlags flag,
@@ -6900,15 +6857,6 @@ nm_device_connection_is_available (NMDevice *self,
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
gboolean available = FALSE;
- if (nm_device_get_default_unmanaged (self) && (priv->state == NM_DEVICE_STATE_UNMANAGED)) {
- /* default-unmanaged devices in UNMANAGED state have no available connections
- * so we must manually check whether the connection is available here.
- */
- if ( nm_device_check_connection_compatible (self, connection)
- && NM_DEVICE_GET_CLASS (self)->check_connection_available (self, connection, NULL))
- return TRUE;
- }
-
available = !!g_hash_table_lookup (priv->available_connections, connection);
if (!available && allow_device_override) {
/* FIXME: hack for hidden WiFi becuase clients didn't consistently
@@ -6941,8 +6889,7 @@ _clear_available_connections (NMDevice *self, gboolean do_signal)
static gboolean
_try_add_available_connection (NMDevice *self, NMConnection *connection)
{
- if ( nm_device_get_state (self) < NM_DEVICE_STATE_DISCONNECTED
- && !nm_device_get_default_unmanaged (self))
+ if (nm_device_get_state (self) < NM_DEVICE_STATE_DISCONNECTED)
return FALSE;
if (nm_device_check_connection_compatible (self, connection)) {
@@ -7639,8 +7586,7 @@ _set_state_full (NMDevice *self,
}
/* Update the available connections list when a device first becomes available */
- if ( (state >= NM_DEVICE_STATE_DISCONNECTED && old_state < NM_DEVICE_STATE_DISCONNECTED)
- || nm_device_get_default_unmanaged (self))
+ if (state >= NM_DEVICE_STATE_DISCONNECTED && old_state < NM_DEVICE_STATE_DISCONNECTED)
nm_device_recheck_available_connections (self);
/* Handle the new state here; but anything that could trigger
@@ -7737,9 +7683,6 @@ _set_state_full (NMDevice *self,
} else {
if (old_state == NM_DEVICE_STATE_UNMANAGED)
_LOGD (LOGD_DEVICE, "device not yet available for transition to DISCONNECTED");
- else if ( old_state > NM_DEVICE_STATE_UNAVAILABLE
- && nm_device_get_default_unmanaged (self))
- nm_device_queue_state (self, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE);
}
break;
case NM_DEVICE_STATE_DEACTIVATING:
@@ -7769,9 +7712,7 @@ _set_state_full (NMDevice *self,
priv->queued_act_request = NULL;
_device_activate (self, queued_req);
g_object_unref (queued_req);
- } else if ( old_state > NM_DEVICE_STATE_DISCONNECTED
- && nm_device_get_default_unmanaged (self))
- nm_device_queue_state (self, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE);
+ }
break;
case NM_DEVICE_STATE_ACTIVATED:
_LOGI (LOGD_DEVICE, "Activation: successful, device activated.");
@@ -8290,15 +8231,6 @@ constructed (GObject *object)
G_CALLBACK (cp_connection_updated),
self);
- /* Update default-unmanaged device available connections immediately,
- * since they don't transition from UNMANAGED (and thus the state handler
- * doesn't run and update them) until something external happens.
- */
- if (nm_device_get_default_unmanaged (self)) {
- nm_device_set_autoconnect (self, FALSE);
- nm_device_recheck_available_connections (self);
- }
-
G_OBJECT_CLASS (nm_device_parent_class)->constructed (object);
}
diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h
index e6f07f2ef3..df9dd27e68 100644
--- a/src/devices/nm-device.h
+++ b/src/devices/nm-device.h
@@ -310,7 +310,6 @@ RfKillType nm_device_get_rfkill_type (NMDevice *device);
/**
* NMUnmanagedFlags:
* @NM_UNMANAGED_NONE: placeholder value
- * @NM_UNMANAGED_DEFAULT: %TRUE when unmanaged by default (ie, Generic devices)
* @NM_UNMANAGED_INTERNAL: %TRUE when unmanaged by internal decision (ie,
* because NM is sleeping or not managed for some other reason)
* @NM_UNMANAGED_USER: %TRUE when unmanaged by user decision (via unmanaged-specs)
@@ -319,7 +318,6 @@ RfKillType nm_device_get_rfkill_type (NMDevice *device);
*/
typedef enum {
NM_UNMANAGED_NONE = 0x00,
- NM_UNMANAGED_DEFAULT = 0x01,
NM_UNMANAGED_INTERNAL = 0x02,
NM_UNMANAGED_USER = 0x04,
NM_UNMANAGED_PARENT = 0x08,
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 7fef779ccc..57e45985de 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -1720,13 +1720,6 @@ recheck_assume_connection (NMDevice *device, gpointer user_data)
nm_device_state_changed (device,
NM_DEVICE_STATE_UNAVAILABLE,
NM_DEVICE_STATE_REASON_CONFIG_FAILED);
-
- /* Return default-unmanaged devices to their original state */
- if (nm_device_get_unmanaged_flag (device, NM_UNMANAGED_DEFAULT)) {
- nm_device_state_changed (device,
- NM_DEVICE_STATE_UNMANAGED,
- NM_DEVICE_STATE_REASON_CONFIG_FAILED);
- }
}
if (generated) {