From 61744d41bb1cd8b994b36bcdce98b0991590cef0 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 7 Nov 2013 01:04:06 -0600 Subject: [PATCH] core: add nm_active_connection_[get|set]_assumed() Various code during the activation paths will want to know whether the connection is assumed or not, so that it doesn't do stuff that touches the device. --- src/nm-active-connection.c | 17 +++++++++++++++++ src/nm-active-connection.h | 5 +++++ src/nm-manager.c | 1 + 3 files changed, 23 insertions(+) diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index c2442d46ab..44ff71624c 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -55,6 +55,8 @@ typedef struct { NMActiveConnection *master; gboolean master_ready; + gboolean assumed; + NMAuthChain *chain; const char *wifi_shared_permission; NMActiveConnectionAuthResultFunc result_func; @@ -498,6 +500,21 @@ nm_active_connection_set_master (NMActiveConnection *self, NMActiveConnection *m check_master_ready (self); } +void +nm_active_connection_set_assumed (NMActiveConnection *self, gboolean assumed) +{ + NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self); + + g_return_if_fail (priv->assumed == FALSE); + priv->assumed = assumed; +} + +gboolean +nm_active_connection_get_assumed (NMActiveConnection *self) +{ + return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->assumed; +} + /****************************************************************/ static void diff --git a/src/nm-active-connection.h b/src/nm-active-connection.h index fa9e5fde4c..074aba9734 100644 --- a/src/nm-active-connection.h +++ b/src/nm-active-connection.h @@ -129,4 +129,9 @@ gboolean nm_active_connection_get_master_ready (NMActiveConnection *self); void nm_active_connection_set_master (NMActiveConnection *self, NMActiveConnection *master); +void nm_active_connection_set_assumed (NMActiveConnection *self, + gboolean assumed); + +gboolean nm_active_connection_get_assumed (NMActiveConnection *self); + #endif /* NM_ACTIVE_CONNECTION_H */ diff --git a/src/nm-manager.c b/src/nm-manager.c index 552e2d6d12..8b059cc7de 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -1956,6 +1956,7 @@ add_device (NMManager *self, NMDevice *device, gboolean nm_created) subject = nm_auth_subject_new_internal (); active = _new_active_connection (self, connection, NULL, device, subject, &error); if (active) { + nm_active_connection_set_assumed (active, TRUE); nm_active_connection_export (active); active_connection_add (self, active); nm_device_activate (device, NM_ACT_REQUEST (active));