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.
This commit is contained in:
Dan Williams 2013-11-07 01:04:06 -06:00
parent e7567859c9
commit 61744d41bb
3 changed files with 23 additions and 0 deletions

View file

@ -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

View file

@ -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 */

View file

@ -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));