diff --git a/src/nm-activation-request.c b/src/nm-activation-request.c index d0b1934b29..ce9ee7da82 100644 --- a/src/nm-activation-request.c +++ b/src/nm-activation-request.c @@ -344,9 +344,6 @@ device_state_changed (NMDevice *device, GParamSpec *pspec, NMActRequest *self) * etc) that will be used to activate @connection and @device * @subject: the #NMAuthSubject representing the requestor of the activation * @device: the device/interface to configure according to @connection - * @master: if the activation depends on another device (ie, bond or bridge - * or team master to which this device will be enslaved) pass the #NMDevice - * that this activation request be enslaved to * * Begins activation of @device using the given @connection and other details. * @@ -356,8 +353,7 @@ NMActRequest * nm_act_request_new (NMConnection *connection, const char *specific_object, NMAuthSubject *subject, - NMDevice *device, - NMDevice *master) + NMDevice *device) { g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); g_return_val_if_fail (NM_IS_DEVICE (device), NULL); @@ -368,7 +364,6 @@ nm_act_request_new (NMConnection *connection, NM_ACTIVE_CONNECTION_INT_DEVICE, device, NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, specific_object, NM_ACTIVE_CONNECTION_INT_SUBJECT, subject, - NM_ACTIVE_CONNECTION_INT_MASTER, master, NULL); } diff --git a/src/nm-activation-request.h b/src/nm-activation-request.h index 2d5d864b2c..87ea41f916 100644 --- a/src/nm-activation-request.h +++ b/src/nm-activation-request.h @@ -49,8 +49,7 @@ GType nm_act_request_get_type (void); NMActRequest *nm_act_request_new (NMConnection *connection, const char *specific_object, NMAuthSubject *subject, - NMDevice *device, - NMDevice *master); + NMDevice *device); NMConnection *nm_act_request_get_connection (NMActRequest *req); diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index e4bdff0474..72ee79823d 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -265,6 +265,32 @@ nm_active_connection_get_master (NMActiveConnection *self) return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->master; } +/** + * nm_active_connection_set_master: + * @self: the #NMActiveConnection + * @master: if the activation depends on another device (ie, bond or bridge + * master to which this device will be enslaved) pass the #NMDevice that this + * activation request be enslaved to + * + * Sets the master device of the active connection. + */ +void +nm_active_connection_set_master (NMActiveConnection *self, NMDevice *master) +{ + NMActiveConnectionPrivate *priv; + + g_return_if_fail (NM_IS_ACTIVE_CONNECTION (self)); + g_return_if_fail (NM_IS_DEVICE (self)); + + priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self); + /* Master is write-once, and must be set before exporting the object */ + g_return_if_fail (priv->master == NULL); + g_return_if_fail (priv->path == NULL); + g_return_if_fail (master != priv->device); + + priv->master = g_object_ref (master); +} + /****************************************************************/ static void @@ -404,10 +430,7 @@ set_property (GObject *object, guint prop_id, priv->subject = g_value_dup_object (value); break; case PROP_INT_MASTER: - g_warn_if_fail (priv->master == NULL); - priv->master = g_value_dup_object (value); - if (priv->master) - g_warn_if_fail (priv->master != priv->device); + nm_active_connection_set_master (NM_ACTIVE_CONNECTION (object), g_value_get_object (value)); break; case PROP_SPECIFIC_OBJECT: tmp = g_value_get_boxed (value); @@ -608,7 +631,7 @@ nm_active_connection_class_init (NMActiveConnectionClass *ac_class) "Internal master device", "Internal device", NM_TYPE_DEVICE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_READWRITE)); nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), G_TYPE_FROM_CLASS (ac_class), diff --git a/src/nm-active-connection.h b/src/nm-active-connection.h index e4c097e6f4..96c7cba72c 100644 --- a/src/nm-active-connection.h +++ b/src/nm-active-connection.h @@ -109,4 +109,6 @@ gulong nm_active_connection_get_user_uid (NMActiveConnection *self); NMDevice * nm_active_connection_get_master (NMActiveConnection *self); +void nm_active_connection_set_master (NMActiveConnection *self, NMDevice *master); + #endif /* NM_ACTIVE_CONNECTION_H */ diff --git a/src/nm-manager.c b/src/nm-manager.c index dd732f8ca1..f8cfa7fc9e 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -2559,9 +2559,9 @@ internal_activate_device (NMManager *manager, req = nm_act_request_new (connection, specific_object, subject, - device, - master_device); + device); g_assert (req); + nm_active_connection_set_master (NM_ACTIVE_CONNECTION (req), master_device); nm_device_activate (device, req); return NM_ACTIVE_CONNECTION (req);