diff --git a/introspection/nm-device.xml b/introspection/nm-device.xml index 13c542a6d0..5fdda96d39 100644 --- a/introspection/nm-device.xml +++ b/introspection/nm-device.xml @@ -51,6 +51,14 @@ The current state of the device. + + + Object path of an ActiveConnection object that "owns" this device during + activation. The ActiveConnection object tracks the life-cycle of a + connection to a specific network and implements the + org.freedesktop.NetworkManager.Connection.Active D-Bus interface. + + Object path of the Ip4Config object describing the configuration of the device. Only valid when the device is in the NM_DEVICE_STATE_ACTIVATED state. diff --git a/src/nm-device-interface.c b/src/nm-device-interface.c index 6d2b8762fd..fb471f577c 100644 --- a/src/nm-device-interface.c +++ b/src/nm-device-interface.c @@ -164,6 +164,14 @@ nm_device_interface_init (gpointer g_iface) 0, G_MAXUINT32, NM_DEVICE_STATE_UNKNOWN, G_PARAM_READABLE)); + g_object_interface_install_property + (g_iface, + g_param_spec_boxed (NM_DEVICE_INTERFACE_ACTIVE_CONNECTION, + "ActiveConnection", + "ActiveConnection", + DBUS_TYPE_G_OBJECT_PATH, + G_PARAM_READABLE)); + g_object_interface_install_property (g_iface, g_param_spec_uint (NM_DEVICE_INTERFACE_DEVICE_TYPE, diff --git a/src/nm-device-interface.h b/src/nm-device-interface.h index f39e8459db..560cdfe517 100644 --- a/src/nm-device-interface.h +++ b/src/nm-device-interface.h @@ -58,6 +58,7 @@ typedef enum #define NM_DEVICE_INTERFACE_IP6_CONFIG "ip6-config" #define NM_DEVICE_INTERFACE_DHCP6_CONFIG "dhcp6-config" #define NM_DEVICE_INTERFACE_STATE "state" +#define NM_DEVICE_INTERFACE_ACTIVE_CONNECTION "active-connection" #define NM_DEVICE_INTERFACE_DEVICE_TYPE "device-type" /* ugh */ #define NM_DEVICE_INTERFACE_MANAGED "managed" #define NM_DEVICE_INTERFACE_FIRMWARE_MISSING "firmware-missing" @@ -79,6 +80,7 @@ typedef enum { NM_DEVICE_INTERFACE_PROP_IP6_CONFIG, NM_DEVICE_INTERFACE_PROP_DHCP6_CONFIG, NM_DEVICE_INTERFACE_PROP_STATE, + NM_DEVICE_INTERFACE_PROP_ACTIVE_CONNECTION, NM_DEVICE_INTERFACE_PROP_DEVICE_TYPE, NM_DEVICE_INTERFACE_PROP_MANAGED, NM_DEVICE_INTERFACE_PROP_FIRMWARE_MISSING, diff --git a/src/nm-device.c b/src/nm-device.c index 5e0b1ff790..4b7ec5dfbb 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -3463,6 +3463,7 @@ get_property (GObject *object, guint prop_id, NMDevice *self = NM_DEVICE (object); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMDeviceState state; + const char *ac_path = NULL; state = nm_device_get_state (self); @@ -3518,6 +3519,11 @@ get_property (GObject *object, guint prop_id, case NM_DEVICE_INTERFACE_PROP_STATE: g_value_set_uint (value, priv->state); break; + case NM_DEVICE_INTERFACE_PROP_ACTIVE_CONNECTION: + if (priv->act_request) + ac_path = nm_act_request_get_active_connection_path (priv->act_request); + g_value_set_boxed (value, ac_path ? ac_path : "/"); + break; case NM_DEVICE_INTERFACE_PROP_DEVICE_TYPE: g_value_set_uint (value, priv->type); break; @@ -3615,6 +3621,10 @@ nm_device_class_init (NMDeviceClass *klass) NM_DEVICE_INTERFACE_PROP_STATE, NM_DEVICE_INTERFACE_STATE); + g_object_class_override_property (object_class, + NM_DEVICE_INTERFACE_PROP_ACTIVE_CONNECTION, + NM_DEVICE_INTERFACE_ACTIVE_CONNECTION); + g_object_class_override_property (object_class, NM_DEVICE_INTERFACE_PROP_DEVICE_TYPE, NM_DEVICE_INTERFACE_DEVICE_TYPE);