summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--introspection/nm-active-connection.xml2
-rw-r--r--src/nm-activation-request.c8
-rw-r--r--src/nm-active-connection.c10
-rw-r--r--src/nm-device.c35
-rw-r--r--src/nm-device.h4
-rw-r--r--src/nm-policy.c40
-rw-r--r--src/vpn-manager/nm-vpn-connection.c6
7 files changed, 19 insertions, 86 deletions
diff --git a/introspection/nm-active-connection.xml b/introspection/nm-active-connection.xml
index 710e0e1a27..ef01ab1609 100644
--- a/introspection/nm-active-connection.xml
+++ b/introspection/nm-active-connection.xml
@@ -37,7 +37,7 @@
<property name="Vpn" type="b" access="read">
<tp:docstring>Whether this active connection is also a VPN connection.</tp:docstring>
</property>
- <property name="Master" type="s" access="read">
+ <property name="Master" type="o" access="read">
<tp:docstring>The path to the master device if the connection is a slave.</tp:docstring>
</property>
diff --git a/src/nm-activation-request.c b/src/nm-activation-request.c
index 56ca774a8f..3fc7b538dc 100644
--- a/src/nm-activation-request.c
+++ b/src/nm-activation-request.c
@@ -504,10 +504,16 @@ get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object);
+ NMDevice *master;
switch (prop_id) {
case PROP_MASTER:
- g_value_set_string (value, nm_device_get_master_path (priv->device));
+ if (priv->dep && NM_IS_ACT_REQUEST (priv->dep)) {
+ master = NM_DEVICE (nm_act_request_get_device (NM_ACT_REQUEST (priv->dep)));
+ g_assert (master);
+ g_value_set_boxed (value, nm_device_get_path (master));
+ } else
+ g_value_set_boxed (value, "/");
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index 5d286356a5..2de621970e 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -353,11 +353,11 @@ nm_active_connection_class_init (NMActiveConnectionClass *vpn_class)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_MASTER,
- g_param_spec_string (NM_ACTIVE_CONNECTION_MASTER,
- "Master",
- "Path of master device",
- NULL,
- G_PARAM_READABLE));
+ g_param_spec_boxed (NM_ACTIVE_CONNECTION_MASTER,
+ "Master",
+ "Path of master device",
+ DBUS_TYPE_G_OBJECT_PATH,
+ G_PARAM_READABLE));
/* Signals */
signals[PROPERTIES_CHANGED] =
diff --git a/src/nm-device.c b/src/nm-device.c
index 4f62b37d17..204cd4fd48 100644
--- a/src/nm-device.c
+++ b/src/nm-device.c
@@ -585,38 +585,6 @@ nm_device_get_type_desc (NMDevice *self)
return NM_DEVICE_GET_PRIVATE (self)->type_desc;
}
-NMDevice *
-nm_device_get_master (NMDevice *self)
-{
- g_return_val_if_fail (self != NULL, NULL);
-
- return NM_DEVICE_GET_PRIVATE (self)->master;
-}
-
-const char *
-nm_device_get_master_path (NMDevice *self)
-{
- g_return_val_if_fail (self != NULL, NULL);
-
- if (NM_DEVICE_GET_PRIVATE (self)->master)
- return nm_device_get_path (NM_DEVICE_GET_PRIVATE (self)->master);
-
- return NULL;
-}
-
-void
-nm_device_set_master (NMDevice *self, NMDevice *master)
-{
- NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
-
- if (priv->master)
- g_object_unref (priv->master);
- priv->master = master ? g_object_ref (master) : NULL;
-
- if (priv->act_request)
- g_object_notify (G_OBJECT (priv->act_request), NM_ACTIVE_CONNECTION_MASTER);
-}
-
/**
* nm_device_enslave_slave:
* @dev: the master device
@@ -3736,9 +3704,6 @@ finalize (GObject *object)
if (priv->dhcp_anycast_address)
g_byte_array_free (priv->dhcp_anycast_address, TRUE);
- /* release master reference it still exists */
- nm_device_set_master (self, NULL);
-
G_OBJECT_CLASS (nm_device_parent_class)->finalize (object);
}
diff --git a/src/nm-device.h b/src/nm-device.h
index d1fbbd8962..5a8cb7a6ae 100644
--- a/src/nm-device.h
+++ b/src/nm-device.h
@@ -191,10 +191,6 @@ NMDHCP6Config * nm_device_get_dhcp6_config (NMDevice *dev);
NMIP4Config * nm_device_get_ip4_config (NMDevice *dev);
NMIP6Config * nm_device_get_ip6_config (NMDevice *dev);
-NMDevice * nm_device_get_master (NMDevice *self);
-const char *nm_device_get_master_path (NMDevice *self);
-void nm_device_set_master (NMDevice *self, NMDevice *master);
-
gboolean nm_device_enslave_slave (NMDevice *dev, NMDevice *slave);
gboolean nm_device_release_slave (NMDevice *dev, NMDevice *slave);
diff --git a/src/nm-policy.c b/src/nm-policy.c
index 12bb43aca5..65ef1b8057 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -729,39 +729,6 @@ activate_data_free (ActivateData *data)
}
static gboolean
-check_master_dependency (NMManager *manager, NMDevice *device, NMConnection *connection)
-{
- NMSettingConnection *s_con;
- NMDevice *master_device;
- const char *master;
- NMActRequest *req;
-
- s_con = nm_connection_get_setting_connection (connection);
- g_assert (s_con);
-
- master = nm_setting_connection_get_master (s_con);
-
- /* no master defined, proceed with activation */
- if (!master)
- return TRUE;
-
- master_device = nm_manager_get_device_by_master (manager, master, NULL);
-
- /* If master device is not yet present, postpone activation until later */
- if (!master_device)
- return FALSE;
-
- /* Make all slaves wait for the master connection to activate. */
- req = nm_device_get_act_request (master_device);
- if (!req || !nm_act_request_get_connection (req))
- return FALSE;
-
- nm_device_set_master (device, master_device);
-
- return TRUE;
-}
-
-static gboolean
auto_activate_device (gpointer user_data)
{
ActivateData *data = (ActivateData *) user_data;
@@ -817,12 +784,6 @@ auto_activate_device (gpointer user_data)
if (best_connection) {
GError *error = NULL;
- if (!check_master_dependency (data->policy->manager, data->device, best_connection)) {
- nm_log_info (LOGD_DEVICE, "Connection '%s' auto-activation postponed: master not available",
- nm_connection_get_id (best_connection));
- goto postpone;
- }
-
nm_log_info (LOGD_DEVICE, "Auto-activating connection '%s'.",
nm_connection_get_id (best_connection));
if (!nm_manager_activate_connection (policy->manager,
@@ -839,7 +800,6 @@ auto_activate_device (gpointer user_data)
}
}
- postpone:
g_slist_free (connections);
out:
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index 9d71f308e0..212be0b490 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -107,6 +107,7 @@ enum {
PROP_0,
PROP_VPN_STATE,
PROP_BANNER,
+ PROP_MASTER = 2000,
LAST_PROP
};
@@ -1170,6 +1171,9 @@ get_property (GObject *object, guint prop_id,
case PROP_BANNER:
g_value_set_string (value, priv->banner ? priv->banner : "");
break;
+ case PROP_MASTER:
+ g_value_set_boxed (value, nm_device_get_path (priv->parent_dev));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1189,6 +1193,8 @@ nm_vpn_connection_class_init (NMVPNConnectionClass *connection_class)
object_class->dispose = dispose;
object_class->finalize = finalize;
+ g_object_class_override_property (object_class, PROP_MASTER, NM_ACTIVE_CONNECTION_MASTER);
+
/* properties */
g_object_class_install_property (object_class, PROP_VPN_STATE,
g_param_spec_uint (NM_VPN_CONNECTION_VPN_STATE,