d4c1522
From fe2fb7137c2fec59222db890d516a81a16cc0a60 Mon Sep 17 00:00:00 2001
d4c1522
From: Dan Winship <danw@gnome.org>
d4c1522
Date: Thu, 19 Dec 2013 09:11:20 -0500
d4c1522
Subject: [PATCH 1/4] introspection: wrap long lines in
d4c1522
 nm-active-connection.xml
d4c1522
MIME-Version: 1.0
d4c1522
Content-Type: text/plain; charset=UTF-8
d4c1522
Content-Transfer-Encoding: 8bit
d4c1522
d4c1522
d4c1522
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
d4c1522
---
d4c1522
 introspection/nm-active-connection.xml | 31 ++++++++++++++++++++++++-------
d4c1522
 1 file changed, 24 insertions(+), 7 deletions(-)
d4c1522
d4c1522
diff --git a/introspection/nm-active-connection.xml b/introspection/nm-active-connection.xml
d4c1522
index b6a3c48..d77f0d0 100644
d4c1522
--- a/introspection/nm-active-connection.xml
d4c1522
+++ b/introspection/nm-active-connection.xml
d4c1522
@@ -11,7 +11,9 @@
d4c1522
     </tp:docstring>
d4c1522
 
d4c1522
     <property name="Connection" type="o" access="read">
d4c1522
-      <tp:docstring>The path of the connection.</tp:docstring>
d4c1522
+      <tp:docstring>
d4c1522
+        The path of the connection.
d4c1522
+      </tp:docstring>
d4c1522
     </property>
d4c1522
     <property name="SpecificObject" type="o" access="read">
d4c1522
       <tp:docstring>
d4c1522
@@ -27,22 +29,37 @@
d4c1522
       </tp:docstring>
d4c1522
     </property>
d4c1522
     <property name="Devices" type="ao" access="read">
d4c1522
-      <tp:docstring>Array of object paths representing devices which are part of this active connection.</tp:docstring>
d4c1522
+      <tp:docstring>
d4c1522
+        Array of object paths representing devices which are part of this active
d4c1522
+        connection.
d4c1522
+      </tp:docstring>
d4c1522
     </property>
d4c1522
     <property name="State" type="u" access="read" tp:type="NM_ACTIVE_CONNECTION_STATE">
d4c1522
-      <tp:docstring>The state of this active connection.</tp:docstring>
d4c1522
+      <tp:docstring>
d4c1522
+        The state of this active connection.
d4c1522
+      </tp:docstring>
d4c1522
     </property>
d4c1522
     <property name="Default" type="b" access="read">
d4c1522
-      <tp:docstring>Whether this active connection is the default IPv4 connection, i.e. whether it currently owns the default IPv4 route.</tp:docstring>
d4c1522
+      <tp:docstring>
d4c1522
+        Whether this active connection is the default IPv4 connection, i.e.
d4c1522
+        whether it currently owns the default IPv4 route.
d4c1522
+      </tp:docstring>
d4c1522
     </property>
d4c1522
     <property name="Default6" type="b" access="read">
d4c1522
-      <tp:docstring>Whether this active connection is the default IPv6 connection, i.e. whether it currently owns the default IPv6 route.</tp:docstring>
d4c1522
+      <tp:docstring>
d4c1522
+        Whether this active connection is the default IPv6 connection, i.e.
d4c1522
+        whether it currently owns the default IPv6 route.
d4c1522
+      </tp:docstring>
d4c1522
     </property>
d4c1522
     <property name="Vpn" type="b" access="read">
d4c1522
-      <tp:docstring>Whether this active connection is also a VPN connection.</tp:docstring>
d4c1522
+      <tp:docstring>
d4c1522
+        Whether this active connection is also a VPN connection.
d4c1522
+      </tp:docstring>
d4c1522
     </property>
d4c1522
     <property name="Master" type="o" access="read">
d4c1522
-      <tp:docstring>The path to the master device if the connection is a slave.</tp:docstring>
d4c1522
+      <tp:docstring>
d4c1522
+        The path to the master device if the connection is a slave.
d4c1522
+      </tp:docstring>
d4c1522
     </property>
d4c1522
 
d4c1522
     <signal name="PropertiesChanged">
d4c1522
-- 
d4c1522
1.7.11.7
d4c1522
d4c1522
d4c1522
From f642e88afd2bf585036ca8af54c81976cd2f259b Mon Sep 17 00:00:00 2001
d4c1522
From: Dan Winship <danw@gnome.org>
d4c1522
Date: Wed, 18 Dec 2013 08:46:43 -0500
d4c1522
Subject: [PATCH 2/4] core: add IP/DHCP config properties to
d4c1522
 o.fd.NM.Connection.Active
d4c1522
MIME-Version: 1.0
d4c1522
Content-Type: text/plain; charset=UTF-8
d4c1522
Content-Transfer-Encoding: 8bit
d4c1522
d4c1522
Add IP and DHCP config properties to the D-Bus ActiveConnection
d4c1522
objects.
d4c1522
d4c1522
For device connections, this is redundant with the properties already
d4c1522
on the Device object, but for VPN connections, this information was
d4c1522
not previously available.
d4c1522
d4c1522
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
d4c1522
---
d4c1522
 introspection/nm-active-connection.xml | 30 ++++++++++++++
d4c1522
 src/nm-activation-request.c            | 71 ++++++++++++++++++++++++++++++++++
d4c1522
 src/nm-active-connection.c             | 53 +++++++++++++++++++++++++
d4c1522
 src/nm-active-connection.h             |  4 ++
d4c1522
 src/vpn-manager/nm-vpn-connection.c    | 23 +++++++++++
d4c1522
 5 files changed, 181 insertions(+)
d4c1522
d4c1522
diff --git a/introspection/nm-active-connection.xml b/introspection/nm-active-connection.xml
d4c1522
index d77f0d0..56a1013 100644
d4c1522
--- a/introspection/nm-active-connection.xml
d4c1522
+++ b/introspection/nm-active-connection.xml
d4c1522
@@ -45,12 +45,42 @@
d4c1522
         whether it currently owns the default IPv4 route.
d4c1522
       </tp:docstring>
d4c1522
     </property>
d4c1522
+    <property name="Ip4Config" type="o" access="read">
d4c1522
+      <tp:docstring>
d4c1522
+        Object path of the Ip4Config object describing the configuration of the
d4c1522
+        connection. Only valid when the connection is in the
d4c1522
+        NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
d4c1522
+      </tp:docstring>
d4c1522
+    </property>
d4c1522
+    <property name="Dhcp4Config" type="o" access="read">
d4c1522
+      <tp:docstring>
d4c1522
+        Object path of the Dhcp4Config object describing the DHCP options
d4c1522
+        returned by the DHCP server (assuming the connection used DHCP). Only
d4c1522
+        valid when the connection is in the NM_ACTIVE_CONNECTION_STATE_ACTIVATED
d4c1522
+        state.
d4c1522
+      </tp:docstring>
d4c1522
+    </property>
d4c1522
     <property name="Default6" type="b" access="read">
d4c1522
       <tp:docstring>
d4c1522
         Whether this active connection is the default IPv6 connection, i.e.
d4c1522
         whether it currently owns the default IPv6 route.
d4c1522
       </tp:docstring>
d4c1522
     </property>
d4c1522
+    <property name="Ip6Config" type="o" access="read">
d4c1522
+      <tp:docstring>
d4c1522
+        Object path of the Ip6Config object describing the configuration of the
d4c1522
+        connection. Only valid when the connection is in the
d4c1522
+        NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
d4c1522
+      </tp:docstring>
d4c1522
+    </property>
d4c1522
+    <property name="Dhcp6Config" type="o" access="read">
d4c1522
+      <tp:docstring>
d4c1522
+        Object path of the Dhcp6Config object describing the DHCP options
d4c1522
+        returned by the DHCP server (assuming the connection used DHCP). Only
d4c1522
+        valid when the connection is in the NM_ACTIVE_CONNECTION_STATE_ACTIVATED
d4c1522
+        state.
d4c1522
+      </tp:docstring>
d4c1522
+    </property>
d4c1522
     <property name="Vpn" type="b" access="read">
d4c1522
       <tp:docstring>
d4c1522
         Whether this active connection is also a VPN connection.
d4c1522
diff --git a/src/nm-activation-request.c b/src/nm-activation-request.c
d4c1522
index 0f3c91e..5fa0fc3 100644
d4c1522
--- a/src/nm-activation-request.c
d4c1522
+++ b/src/nm-activation-request.c
d4c1522
@@ -56,6 +56,16 @@ typedef struct {
d4c1522
 	GSList *share_rules;
d4c1522
 } NMActRequestPrivate;
d4c1522
 
d4c1522
+enum {
d4c1522
+	PROP_0,
d4c1522
+	PROP_IP4_CONFIG,
d4c1522
+	PROP_DHCP4_CONFIG,
d4c1522
+	PROP_IP6_CONFIG,
d4c1522
+	PROP_DHCP6_CONFIG,
d4c1522
+
d4c1522
+	LAST_PROP
d4c1522
+};
d4c1522
+
d4c1522
 /*******************************************************************/
d4c1522
 
d4c1522
 NMConnection *
d4c1522
@@ -282,6 +292,14 @@ nm_act_request_add_share_rule (NMActRequest *req,
d4c1522
 /********************************************************************/
d4c1522
 
d4c1522
 static void
d4c1522
+device_notify (GObject    *object,
d4c1522
+               GParamSpec *pspec,
d4c1522
+               gpointer    self)
d4c1522
+{
d4c1522
+	g_object_notify (self, pspec->name);
d4c1522
+}
d4c1522
+
d4c1522
+static void
d4c1522
 device_state_changed (NMDevice *device, GParamSpec *pspec, NMActRequest *self)
d4c1522
 {
d4c1522
 	NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self);
d4c1522
@@ -301,6 +319,15 @@ device_state_changed (NMActiveConnection *active,
d4c1522
 		break;
d4c1522
 	case NM_DEVICE_STATE_ACTIVATED:
d4c1522
 		ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED;
d4c1522
+
d4c1522
+		g_signal_connect (device, "notify::" NM_DEVICE_IP4_CONFIG,
d4c1522
+		                  G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
d4c1522
+		g_signal_connect (device, "notify::" NM_DEVICE_DHCP4_CONFIG,
d4c1522
+		                  G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
d4c1522
+		g_signal_connect (device, "notify::" NM_DEVICE_IP6_CONFIG,
d4c1522
+		                  G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
d4c1522
+		g_signal_connect (device, "notify::" NM_DEVICE_DHCP6_CONFIG,
d4c1522
+		                  G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
d4c1522
 		break;
d4c1522
 	case NM_DEVICE_STATE_DEACTIVATING:
d4c1522
 		ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATING;
d4c1522
@@ -310,6 +337,8 @@ device_state_changed (NMActiveConnection *active,
d4c1522
 	case NM_DEVICE_STATE_UNAVAILABLE:
d4c1522
 		ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATED;
d4c1522
 
d4c1522
+		g_signal_handlers_disconnect_by_func (device, G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
d4c1522
+
d4c1522
 		/* No longer need to pay attention to device state */
d4c1522
 		if (priv->device && priv->device_state_id) {
d4c1522
 			g_signal_handler_disconnect (priv->device, priv->device_state_id);
d4c1522
@@ -414,6 +443,37 @@ dispose (GObject *object)
d4c1522
 }
d4c1522
 
d4c1522
 static void
d4c1522
+get_property (GObject *object, guint prop_id,
d4c1522
+              GValue *value, GParamSpec *pspec)
d4c1522
+{
d4c1522
+	NMDevice *device;
d4c1522
+
d4c1522
+	device = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (object));
d4c1522
+	if (!device) {
d4c1522
+		g_value_set_boxed (value, "/");
d4c1522
+		return;
d4c1522
+	}
d4c1522
+
d4c1522
+	switch (prop_id) {
d4c1522
+	case PROP_IP4_CONFIG:
d4c1522
+		g_object_get_property (G_OBJECT (device), NM_DEVICE_IP4_CONFIG, value);
d4c1522
+		break;
d4c1522
+	case PROP_DHCP4_CONFIG:
d4c1522
+		g_object_get_property (G_OBJECT (device), NM_DEVICE_DHCP4_CONFIG, value);
d4c1522
+		break;
d4c1522
+	case PROP_IP6_CONFIG:
d4c1522
+		g_object_get_property (G_OBJECT (device), NM_DEVICE_IP6_CONFIG, value);
d4c1522
+		break;
d4c1522
+	case PROP_DHCP6_CONFIG:
d4c1522
+		g_object_get_property (G_OBJECT (device), NM_DEVICE_DHCP6_CONFIG, value);
d4c1522
+		break;
d4c1522
+	default:
d4c1522
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
d4c1522
+		break;
d4c1522
+	}
d4c1522
+}
d4c1522
+
d4c1522
+static void
d4c1522
 nm_act_request_class_init (NMActRequestClass *req_class)
d4c1522
 {
d4c1522
 	GObjectClass *object_class = G_OBJECT_CLASS (req_class);
d4c1522
@@ -423,5 +483,16 @@ nm_act_request_class_init (NMActRequestClass *req_class)
d4c1522
 	/* virtual methods */
d4c1522
 	object_class->constructed = constructed;
d4c1522
 	object_class->dispose = dispose;
d4c1522
+	object_class->get_property = get_property;
d4c1522
+
d4c1522
+	/* properties */
d4c1522
+	g_object_class_override_property (object_class, PROP_IP4_CONFIG,
d4c1522
+	                                  NM_ACTIVE_CONNECTION_IP4_CONFIG);
d4c1522
+	g_object_class_override_property (object_class, PROP_DHCP4_CONFIG,
d4c1522
+	                                  NM_ACTIVE_CONNECTION_DHCP4_CONFIG);
d4c1522
+	g_object_class_override_property (object_class, PROP_IP6_CONFIG,
d4c1522
+	                                  NM_ACTIVE_CONNECTION_IP6_CONFIG);
d4c1522
+	g_object_class_override_property (object_class, PROP_DHCP6_CONFIG,
d4c1522
+	                                  NM_ACTIVE_CONNECTION_DHCP6_CONFIG);
d4c1522
 }
d4c1522
 
d4c1522
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
d4c1522
index a8a422c..3631470 100644
d4c1522
--- a/src/nm-active-connection.c
d4c1522
+++ b/src/nm-active-connection.c
d4c1522
@@ -74,7 +74,11 @@ enum {
d4c1522
 	PROP_DEVICES,
d4c1522
 	PROP_STATE,
d4c1522
 	PROP_DEFAULT,
d4c1522
+	PROP_IP4_CONFIG,
d4c1522
+	PROP_DHCP4_CONFIG,
d4c1522
 	PROP_DEFAULT6,
d4c1522
+	PROP_IP6_CONFIG,
d4c1522
+	PROP_DHCP6_CONFIG,
d4c1522
 	PROP_VPN,
d4c1522
 	PROP_MASTER,
d4c1522
 
d4c1522
@@ -152,6 +156,14 @@ nm_active_connection_set_state (NMActiveConnection *self,
d4c1522
 		}
d4c1522
 	}
d4c1522
 
d4c1522
+	if (   new_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED
d4c1522
+	    || old_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
d4c1522
+		g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP4_CONFIG);
d4c1522
+		g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DHCP4_CONFIG);
d4c1522
+		g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP6_CONFIG);
d4c1522
+		g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DHCP6_CONFIG);
d4c1522
+	}
d4c1522
+
d4c1522
 	if (priv->state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
d4c1522
 		/* Device is no longer relevant when deactivated */
d4c1522
 		g_clear_object (&priv->device);
d4c1522
@@ -712,9 +724,22 @@ get_property (GObject *object, guint prop_id,
d4c1522
 	case PROP_DEFAULT:
d4c1522
 		g_value_set_boolean (value, priv->is_default);
d4c1522
 		break;
d4c1522
+	case PROP_IP4_CONFIG:
d4c1522
+		/* The IP and DHCP config properties may be overridden by a subclass */
d4c1522
+		g_value_set_boxed (value, "/");
d4c1522
+		break;
d4c1522
+	case PROP_DHCP4_CONFIG:
d4c1522
+		g_value_set_boxed (value, "/");
d4c1522
+		break;
d4c1522
 	case PROP_DEFAULT6:
d4c1522
 		g_value_set_boolean (value, priv->is_default6);
d4c1522
 		break;
d4c1522
+	case PROP_IP6_CONFIG:
d4c1522
+		g_value_set_boxed (value, "/");
d4c1522
+		break;
d4c1522
+	case PROP_DHCP6_CONFIG:
d4c1522
+		g_value_set_boxed (value, "/");
d4c1522
+		break;
d4c1522
 	case PROP_VPN:
d4c1522
 		g_value_set_boolean (value, priv->vpn);
d4c1522
 		break;
d4c1522
@@ -838,6 +863,20 @@ nm_active_connection_class_init (NMActiveConnectionClass *ac_class)
d4c1522
 		                      FALSE,
d4c1522
 		                      G_PARAM_READWRITE));
d4c1522
 
d4c1522
+	g_object_class_install_property (object_class, PROP_IP4_CONFIG,
d4c1522
+		 g_param_spec_boxed (NM_ACTIVE_CONNECTION_IP4_CONFIG,
d4c1522
+		                     "IP4 Config",
d4c1522
+		                     "IP4 Config",
d4c1522
+		                     DBUS_TYPE_G_OBJECT_PATH,
d4c1522
+		                     G_PARAM_READABLE));
d4c1522
+
d4c1522
+	g_object_class_install_property (object_class, PROP_DHCP4_CONFIG,
d4c1522
+		 g_param_spec_boxed (NM_ACTIVE_CONNECTION_DHCP4_CONFIG,
d4c1522
+		                     "DHCP4 Config",
d4c1522
+		                     "DHCP4 Config",
d4c1522
+		                     DBUS_TYPE_G_OBJECT_PATH,
d4c1522
+		                     G_PARAM_READABLE));
d4c1522
+
d4c1522
 	g_object_class_install_property (object_class, PROP_DEFAULT6,
d4c1522
 		g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT6,
d4c1522
 		                      "Default6",
d4c1522
@@ -845,6 +884,20 @@ nm_active_connection_class_init (NMActiveConnectionClass *ac_class)
d4c1522
 		                      FALSE,
d4c1522
 		                      G_PARAM_READWRITE));
d4c1522
 
d4c1522
+	g_object_class_install_property (object_class, PROP_IP6_CONFIG,
d4c1522
+		 g_param_spec_boxed (NM_ACTIVE_CONNECTION_IP6_CONFIG,
d4c1522
+		                     "IP6 Config",
d4c1522
+		                     "IP6 Config",
d4c1522
+		                     DBUS_TYPE_G_OBJECT_PATH,
d4c1522
+		                     G_PARAM_READABLE));
d4c1522
+
d4c1522
+	g_object_class_install_property (object_class, PROP_DHCP6_CONFIG,
d4c1522
+		 g_param_spec_boxed (NM_ACTIVE_CONNECTION_DHCP6_CONFIG,
d4c1522
+		                     "DHCP6 Config",
d4c1522
+		                     "DHCP6 Config",
d4c1522
+		                     DBUS_TYPE_G_OBJECT_PATH,
d4c1522
+		                     G_PARAM_READABLE));
d4c1522
+
d4c1522
 	g_object_class_install_property (object_class, PROP_VPN,
d4c1522
 		g_param_spec_boolean (NM_ACTIVE_CONNECTION_VPN,
d4c1522
 		                      "VPN",
d4c1522
diff --git a/src/nm-active-connection.h b/src/nm-active-connection.h
d4c1522
index 43b76bd..2a4df97 100644
d4c1522
--- a/src/nm-active-connection.h
d4c1522
+++ b/src/nm-active-connection.h
d4c1522
@@ -40,7 +40,11 @@
d4c1522
 #define NM_ACTIVE_CONNECTION_DEVICES         "devices"
d4c1522
 #define NM_ACTIVE_CONNECTION_STATE           "state"
d4c1522
 #define NM_ACTIVE_CONNECTION_DEFAULT         "default"
d4c1522
+#define NM_ACTIVE_CONNECTION_IP4_CONFIG      "ip4-config"
d4c1522
+#define NM_ACTIVE_CONNECTION_DHCP4_CONFIG    "dhcp4-config"
d4c1522
 #define NM_ACTIVE_CONNECTION_DEFAULT6        "default6"
d4c1522
+#define NM_ACTIVE_CONNECTION_IP6_CONFIG      "ip6-config"
d4c1522
+#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG    "dhcp6-config"
d4c1522
 #define NM_ACTIVE_CONNECTION_VPN             "vpn"
d4c1522
 #define NM_ACTIVE_CONNECTION_MASTER          "master"
d4c1522
 
d4c1522
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
d4c1522
index 500c72b..a4bc431 100644
d4c1522
--- a/src/vpn-manager/nm-vpn-connection.c
d4c1522
+++ b/src/vpn-manager/nm-vpn-connection.c
d4c1522
@@ -105,6 +105,8 @@ enum {
d4c1522
 	PROP_0,
d4c1522
 	PROP_VPN_STATE,
d4c1522
 	PROP_BANNER,
d4c1522
+	PROP_IP4_CONFIG,
d4c1522
+	PROP_IP6_CONFIG,
d4c1522
 	PROP_MASTER = 2000,
d4c1522
 
d4c1522
 	LAST_PROP
d4c1522
@@ -1011,6 +1013,8 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
d4c1522
 	nm_ip4_config_merge_setting (config, nm_connection_get_setting_ip4_config (priv->connection));
d4c1522
 
d4c1522
 	priv->ip4_config = config;
d4c1522
+	nm_ip4_config_export (config);
d4c1522
+	g_object_notify (G_OBJECT (connection), NM_ACTIVE_CONNECTION_IP4_CONFIG);
d4c1522
 	nm_vpn_connection_config_maybe_complete (connection, TRUE);
d4c1522
 }
d4c1522
 
d4c1522
@@ -1152,6 +1156,8 @@ nm_vpn_connection_ip6_config_get (DBusGProxy *proxy,
d4c1522
 	nm_ip6_config_merge_setting (config, nm_connection_get_setting_ip6_config (priv->connection));
d4c1522
 
d4c1522
 	priv->ip6_config = config;
d4c1522
+	nm_ip6_config_export (config);
d4c1522
+	g_object_notify (G_OBJECT (connection), NM_ACTIVE_CONNECTION_IP6_CONFIG);
d4c1522
 	nm_vpn_connection_config_maybe_complete (connection, TRUE);
d4c1522
 }
d4c1522
 
d4c1522
@@ -1787,6 +1793,18 @@ get_property (GObject *object, guint prop_id,
d4c1522
 	case PROP_BANNER:
d4c1522
 		g_value_set_string (value, priv->banner ? priv->banner : "");
d4c1522
 		break;
d4c1522
+	case PROP_IP4_CONFIG:
d4c1522
+		if (priv->vpn_state == NM_VPN_CONNECTION_STATE_ACTIVATED && priv->ip4_config)
d4c1522
+			g_value_set_boxed (value, nm_ip4_config_get_dbus_path (priv->ip4_config));
d4c1522
+		else
d4c1522
+			g_value_set_boxed (value, "/");
d4c1522
+		break;
d4c1522
+	case PROP_IP6_CONFIG:
d4c1522
+		if (priv->vpn_state == NM_VPN_CONNECTION_STATE_ACTIVATED && priv->ip6_config)
d4c1522
+			g_value_set_boxed (value, nm_ip6_config_get_dbus_path (priv->ip6_config));
d4c1522
+		else
d4c1522
+			g_value_set_boxed (value, "/");
d4c1522
+		break;
d4c1522
 	case PROP_MASTER:
d4c1522
 		g_value_set_boxed (value, nm_device_get_path (priv->parent_dev));
d4c1522
 		break;
d4c1522
@@ -1832,6 +1850,11 @@ nm_vpn_connection_class_init (NMVPNConnectionClass *connection_class)
d4c1522
 		                     NULL,
d4c1522
 		                     G_PARAM_READABLE));
d4c1522
 
d4c1522
+	g_object_class_override_property (object_class, PROP_IP4_CONFIG,
d4c1522
+	                                  NM_ACTIVE_CONNECTION_IP4_CONFIG);
d4c1522
+	g_object_class_override_property (object_class, PROP_IP6_CONFIG,
d4c1522
+	                                  NM_ACTIVE_CONNECTION_IP6_CONFIG);
d4c1522
+
d4c1522
 	/* signals */
d4c1522
 	signals[VPN_STATE_CHANGED] =
d4c1522
 		g_signal_new ("vpn-state-changed",
d4c1522
-- 
d4c1522
1.7.11.7
d4c1522
d4c1522
d4c1522
From 4783f43c530ba7b8d045a1d66001af4ac6463dd4 Mon Sep 17 00:00:00 2001
d4c1522
From: Dan Winship <danw@gnome.org>
d4c1522
Date: Wed, 18 Dec 2013 10:56:09 -0500
d4c1522
Subject: [PATCH 3/4] libnm-glib: expose new NMActiveConnection IP/DHCP config
d4c1522
 properties
d4c1522
MIME-Version: 1.0
d4c1522
Content-Type: text/plain; charset=UTF-8
d4c1522
Content-Transfer-Encoding: 8bit
d4c1522
d4c1522
d4c1522
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
d4c1522
---
d4c1522
 libnm-glib/libnm-glib.ver         |   4 +
d4c1522
 libnm-glib/nm-active-connection.c | 184 ++++++++++++++++++++++++++++++++++++--
d4c1522
 libnm-glib/nm-active-connection.h |  16 +++-
d4c1522
 libnm-glib/nm-device.c            |  16 ++++
d4c1522
 4 files changed, 209 insertions(+), 11 deletions(-)
d4c1522
d4c1522
diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver
d4c1522
index ac784cc..5247ce9 100644
d4c1522
--- a/libnm-glib/libnm-glib.ver
d4c1522
+++ b/libnm-glib/libnm-glib.ver
d4c1522
@@ -23,6 +23,10 @@ global:
d4c1522
 	nm_active_connection_get_default6;
d4c1522
 	nm_active_connection_get_default;
d4c1522
 	nm_active_connection_get_devices;
d4c1522
+	nm_active_connection_get_dhcp4_config;
d4c1522
+	nm_active_connection_get_dhcp6_config;
d4c1522
+	nm_active_connection_get_ip4_config;
d4c1522
+	nm_active_connection_get_ip6_config;
d4c1522
 	nm_active_connection_get_master;
d4c1522
 	nm_active_connection_get_specific_object;
d4c1522
 	nm_active_connection_get_state;
d4c1522
diff --git a/libnm-glib/nm-active-connection.c b/libnm-glib/nm-active-connection.c
d4c1522
index c474483..11f37cf 100644
d4c1522
--- a/libnm-glib/nm-active-connection.c
d4c1522
+++ b/libnm-glib/nm-active-connection.c
d4c1522
@@ -58,7 +58,11 @@ typedef struct {
d4c1522
 	GPtrArray *devices;
d4c1522
 	NMActiveConnectionState state;
d4c1522
 	gboolean is_default;
d4c1522
+	NMIP4Config *ip4_config;
d4c1522
+	NMDHCP4Config *dhcp4_config;
d4c1522
 	gboolean is_default6;
d4c1522
+	NMIP6Config *ip6_config;
d4c1522
+	NMDHCP6Config *dhcp6_config;
d4c1522
 	char *master;
d4c1522
 } NMActiveConnectionPrivate;
d4c1522
 
d4c1522
@@ -70,21 +74,16 @@ enum {
d4c1522
 	PROP_DEVICES,
d4c1522
 	PROP_STATE,
d4c1522
 	PROP_DEFAULT,
d4c1522
+	PROP_IP4_CONFIG,
d4c1522
+	PROP_DHCP4_CONFIG,
d4c1522
 	PROP_DEFAULT6,
d4c1522
+	PROP_IP6_CONFIG,
d4c1522
+	PROP_DHCP6_CONFIG,
d4c1522
 	PROP_MASTER,
d4c1522
 
d4c1522
 	LAST_PROP
d4c1522
 };
d4c1522
 
d4c1522
-#define DBUS_PROP_CONNECTION "Connection"
d4c1522
-#define DBUS_PROP_UUID "Uuid"
d4c1522
-#define DBUS_PROP_SPECIFIC_OBJECT "SpecificObject"
d4c1522
-#define DBUS_PROP_DEVICES "Devices"
d4c1522
-#define DBUS_PROP_STATE "State"
d4c1522
-#define DBUS_PROP_DEFAULT "Default"
d4c1522
-#define DBUS_PROP_DEFAULT6 "Default6"
d4c1522
-#define DBUS_PROP_MASTER "Master"
d4c1522
-
d4c1522
 /**
d4c1522
  * nm_active_connection_new:
d4c1522
  * @connection: the #DBusGConnection
d4c1522
@@ -308,6 +307,49 @@ nm_active_connection_get_default (NMActiveConnection *connection)
d4c1522
 }
d4c1522
 
d4c1522
 /**
d4c1522
+ * nm_active_connection_get_ip4_config:
d4c1522
+ * @connection: an #NMActiveConnection
d4c1522
+ *
d4c1522
+ * Gets the current #NMIP4Config associated with the #NMActiveConnection.
d4c1522
+ *
d4c1522
+ * Returns: (transfer none): the #NMIP4Config, or %NULL if the
d4c1522
+ *   connection is not in the %NM_ACTIVE_CONNECTION_STATE_ACTIVATED
d4c1522
+ *   state.
d4c1522
+ *
d4c1522
+ * Since: 0.9.10
d4c1522
+ **/
d4c1522
+NMIP4Config *
d4c1522
+nm_active_connection_get_ip4_config (NMActiveConnection *connection)
d4c1522
+{
d4c1522
+	g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
d4c1522
+
d4c1522
+	_nm_object_ensure_inited (NM_OBJECT (connection));
d4c1522
+	return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->ip4_config;
d4c1522
+}
d4c1522
+
d4c1522
+/**
d4c1522
+ * nm_active_connection_get_dhcp4_config:
d4c1522
+ * @connection: an #NMActiveConnection
d4c1522
+ *
d4c1522
+ * Gets the current #NMDHCP4Config (if any) associated with the
d4c1522
+ * #NMActiveConnection.
d4c1522
+ *
d4c1522
+ * Returns: (transfer none): the #NMDHCP4Config, or %NULL if the
d4c1522
+ *   connection does not use DHCP, or is not in the
d4c1522
+ *   %NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
d4c1522
+ *
d4c1522
+ * Since: 0.9.10
d4c1522
+ **/
d4c1522
+NMDHCP4Config *
d4c1522
+nm_active_connection_get_dhcp4_config (NMActiveConnection *connection)
d4c1522
+{
d4c1522
+	g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
d4c1522
+
d4c1522
+	_nm_object_ensure_inited (NM_OBJECT (connection));
d4c1522
+	return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->dhcp4_config;
d4c1522
+}
d4c1522
+
d4c1522
+/**
d4c1522
  * nm_active_connection_get_default6:
d4c1522
  * @connection: a #NMActiveConnection
d4c1522
  *
d4c1522
@@ -326,6 +368,49 @@ nm_active_connection_get_default6 (NMActiveConnection *connection)
d4c1522
 }
d4c1522
 
d4c1522
 /**
d4c1522
+ * nm_active_connection_get_ip6_config:
d4c1522
+ * @connection: an #NMActiveConnection
d4c1522
+ *
d4c1522
+ * Gets the current #NMIP6Config associated with the #NMActiveConnection.
d4c1522
+ *
d4c1522
+ * Returns: (transfer none): the #NMIP6Config, or %NULL if the
d4c1522
+ *   connection is not in the %NM_ACTIVE_CONNECTION_STATE_ACTIVATED
d4c1522
+ *   state.
d4c1522
+ *
d4c1522
+ * Since: 0.9.10
d4c1522
+ **/
d4c1522
+NMIP6Config *
d4c1522
+nm_active_connection_get_ip6_config (NMActiveConnection *connection)
d4c1522
+{
d4c1522
+	g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
d4c1522
+
d4c1522
+	_nm_object_ensure_inited (NM_OBJECT (connection));
d4c1522
+	return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->ip6_config;
d4c1522
+}
d4c1522
+
d4c1522
+/**
d4c1522
+ * nm_active_connection_get_dhcp6_config:
d4c1522
+ * @connection: an #NMActiveConnection
d4c1522
+ *
d4c1522
+ * Gets the current #NMDHCP6Config (if any) associated with the
d4c1522
+ * #NMActiveConnection.
d4c1522
+ *
d4c1522
+ * Returns: (transfer none): the #NMDHCP6Config, or %NULL if the
d4c1522
+ *   connection does not use DHCPv6, or is not in the
d4c1522
+ *   %NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
d4c1522
+ *
d4c1522
+ * Since: 0.9.10
d4c1522
+ **/
d4c1522
+NMDHCP6Config *
d4c1522
+nm_active_connection_get_dhcp6_config (NMActiveConnection *connection)
d4c1522
+{
d4c1522
+	g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
d4c1522
+
d4c1522
+	_nm_object_ensure_inited (NM_OBJECT (connection));
d4c1522
+	return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->dhcp6_config;
d4c1522
+}
d4c1522
+
d4c1522
+/**
d4c1522
  * nm_active_connection_get_master:
d4c1522
  * @connection: a #NMActiveConnection
d4c1522
  *
d4c1522
@@ -359,6 +444,11 @@ dispose (GObject *object)
d4c1522
 		priv->devices = NULL;
d4c1522
 	}
d4c1522
 
d4c1522
+	g_clear_object (&priv->ip4_config);
d4c1522
+	g_clear_object (&priv->dhcp4_config);
d4c1522
+	g_clear_object (&priv->ip6_config);
d4c1522
+	g_clear_object (&priv->dhcp6_config);
d4c1522
+
d4c1522
 	g_clear_object (&priv->proxy);
d4c1522
 
d4c1522
 	G_OBJECT_CLASS (nm_active_connection_parent_class)->dispose (object);
d4c1522
@@ -406,9 +496,21 @@ get_property (GObject *object,
d4c1522
 	case PROP_DEFAULT:
d4c1522
 		g_value_set_boolean (value, nm_active_connection_get_default (self));
d4c1522
 		break;
d4c1522
+	case PROP_IP4_CONFIG:
d4c1522
+		g_value_set_object (value, nm_active_connection_get_ip4_config (self));
d4c1522
+		break;
d4c1522
+	case PROP_DHCP4_CONFIG:
d4c1522
+		g_value_set_object (value, nm_active_connection_get_dhcp4_config (self));
d4c1522
+		break;
d4c1522
 	case PROP_DEFAULT6:
d4c1522
 		g_value_set_boolean (value, nm_active_connection_get_default6 (self));
d4c1522
 		break;
d4c1522
+	case PROP_IP6_CONFIG:
d4c1522
+		g_value_set_object (value, nm_active_connection_get_ip6_config (self));
d4c1522
+		break;
d4c1522
+	case PROP_DHCP6_CONFIG:
d4c1522
+		g_value_set_object (value, nm_active_connection_get_dhcp6_config (self));
d4c1522
+		break;
d4c1522
 	case PROP_MASTER:
d4c1522
 		g_value_set_string (value, nm_active_connection_get_master (self));
d4c1522
 		break;
d4c1522
@@ -429,7 +531,11 @@ register_properties (NMActiveConnection *connection)
d4c1522
 		{ NM_ACTIVE_CONNECTION_DEVICES,             &priv->devices, NULL, NM_TYPE_DEVICE },
d4c1522
 		{ NM_ACTIVE_CONNECTION_STATE,               &priv->state },
d4c1522
 		{ NM_ACTIVE_CONNECTION_DEFAULT,             &priv->is_default },
d4c1522
+		{ NM_ACTIVE_CONNECTION_IP4_CONFIG,          &priv->ip4_config, NULL, NM_TYPE_IP4_CONFIG },
d4c1522
+		{ NM_ACTIVE_CONNECTION_DHCP4_CONFIG,        &priv->dhcp4_config, NULL, NM_TYPE_DHCP4_CONFIG },
d4c1522
 		{ NM_ACTIVE_CONNECTION_DEFAULT6,            &priv->is_default6 },
d4c1522
+		{ NM_ACTIVE_CONNECTION_IP6_CONFIG,          &priv->ip6_config, NULL, NM_TYPE_IP6_CONFIG },
d4c1522
+		{ NM_ACTIVE_CONNECTION_DHCP6_CONFIG,        &priv->dhcp6_config, NULL, NM_TYPE_DHCP6_CONFIG },
d4c1522
 		{ NM_ACTIVE_CONNECTION_MASTER,              &priv->master },
d4c1522
 
d4c1522
 		/* not tracked after construction time */
d4c1522
@@ -551,6 +657,36 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
d4c1522
 							   G_PARAM_READABLE));
d4c1522
 
d4c1522
 	/**
d4c1522
+	 * NMActiveConnection:ip4-config:
d4c1522
+	 *
d4c1522
+	 * The #NMIP4Config of the connection.
d4c1522
+	 *
d4c1522
+	 * Since: 0.9.10
d4c1522
+	 **/
d4c1522
+	g_object_class_install_property
d4c1522
+		(object_class, PROP_IP4_CONFIG,
d4c1522
+		 g_param_spec_object (NM_ACTIVE_CONNECTION_IP4_CONFIG,
d4c1522
+		                      "IP4 Config",
d4c1522
+		                      "IP4 Config",
d4c1522
+		                      NM_TYPE_IP4_CONFIG,
d4c1522
+		                      G_PARAM_READABLE));
d4c1522
+
d4c1522
+	/**
d4c1522
+	 * NMActiveConnection:dhcp4-config:
d4c1522
+	 *
d4c1522
+	 * The #NMDHCP4Config of the connection.
d4c1522
+	 *
d4c1522
+	 * Since: 0.9.10
d4c1522
+	 **/
d4c1522
+	g_object_class_install_property
d4c1522
+		(object_class, PROP_DHCP4_CONFIG,
d4c1522
+		 g_param_spec_object (NM_ACTIVE_CONNECTION_DHCP4_CONFIG,
d4c1522
+		                      "DHCP4 Config",
d4c1522
+		                      "DHCP4 Config",
d4c1522
+		                      NM_TYPE_DHCP4_CONFIG,
d4c1522
+		                      G_PARAM_READABLE));
d4c1522
+
d4c1522
+	/**
d4c1522
 	 * NMActiveConnection:default6:
d4c1522
 	 *
d4c1522
 	 * Whether the active connection is the default IPv6 one.
d4c1522
@@ -564,6 +700,36 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
d4c1522
 							   G_PARAM_READABLE));
d4c1522
 
d4c1522
 	/**
d4c1522
+	 * NMActiveConnection:ip6-config:
d4c1522
+	 *
d4c1522
+	 * The #NMIP6Config of the connection.
d4c1522
+	 *
d4c1522
+	 * Since: 0.9.10
d4c1522
+	 **/
d4c1522
+	g_object_class_install_property
d4c1522
+		(object_class, PROP_IP6_CONFIG,
d4c1522
+		 g_param_spec_object (NM_ACTIVE_CONNECTION_IP6_CONFIG,
d4c1522
+		                      "IP6 Config",
d4c1522
+		                      "IP6 Config",
d4c1522
+		                      NM_TYPE_IP6_CONFIG,
d4c1522
+		                      G_PARAM_READABLE));
d4c1522
+
d4c1522
+	/**
d4c1522
+	 * NMActiveConnection:dhcp6-config:
d4c1522
+	 *
d4c1522
+	 * The #NMDHCP6Config of the connection.
d4c1522
+	 *
d4c1522
+	 * Since: 0.9.10
d4c1522
+	 **/
d4c1522
+	g_object_class_install_property
d4c1522
+		(object_class, PROP_DHCP6_CONFIG,
d4c1522
+		 g_param_spec_object (NM_ACTIVE_CONNECTION_DHCP6_CONFIG,
d4c1522
+		                      "DHCP6 Config",
d4c1522
+		                      "DHCP6 Config",
d4c1522
+		                      NM_TYPE_DHCP6_CONFIG,
d4c1522
+		                      G_PARAM_READABLE));
d4c1522
+
d4c1522
+	/**
d4c1522
 	 * NMActiveConnection:master:
d4c1522
 	 *
d4c1522
 	 * The path of the master device if one exists.
d4c1522
diff --git a/libnm-glib/nm-active-connection.h b/libnm-glib/nm-active-connection.h
d4c1522
index c6777f8..49f040d 100644
d4c1522
--- a/libnm-glib/nm-active-connection.h
d4c1522
+++ b/libnm-glib/nm-active-connection.h
d4c1522
@@ -29,6 +29,10 @@
d4c1522
 #include "nm-object.h"
d4c1522
 #include <nm-connection.h>
d4c1522
 #include <NetworkManager.h>
d4c1522
+#include "nm-ip4-config.h"
d4c1522
+#include "nm-dhcp4-config.h"
d4c1522
+#include "nm-ip6-config.h"
d4c1522
+#include "nm-dhcp6-config.h"
d4c1522
 
d4c1522
 G_BEGIN_DECLS
d4c1522
 
d4c1522
@@ -45,7 +49,11 @@ G_BEGIN_DECLS
d4c1522
 #define NM_ACTIVE_CONNECTION_DEVICES             "devices"
d4c1522
 #define NM_ACTIVE_CONNECTION_STATE               "state"
d4c1522
 #define NM_ACTIVE_CONNECTION_DEFAULT             "default"
d4c1522
+#define NM_ACTIVE_CONNECTION_IP4_CONFIG          "ip4-config"
d4c1522
+#define NM_ACTIVE_CONNECTION_DHCP4_CONFIG        "dhcp4-config"
d4c1522
 #define NM_ACTIVE_CONNECTION_DEFAULT6            "default6"
d4c1522
+#define NM_ACTIVE_CONNECTION_IP6_CONFIG          "ip6-config"
d4c1522
+#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG        "dhcp6-config"
d4c1522
 #define NM_ACTIVE_CONNECTION_MASTER              "master"
d4c1522
 
d4c1522
 typedef struct {
d4c1522
@@ -73,9 +81,13 @@ const char * nm_active_connection_get_uuid                (NMActiveConnection *c
d4c1522
 const char * nm_active_connection_get_specific_object     (NMActiveConnection *connection);
d4c1522
 const GPtrArray *nm_active_connection_get_devices         (NMActiveConnection *connection);
d4c1522
 NMActiveConnectionState nm_active_connection_get_state    (NMActiveConnection *connection);
d4c1522
-gboolean nm_active_connection_get_default                 (NMActiveConnection *connection);
d4c1522
-gboolean nm_active_connection_get_default6                (NMActiveConnection *connection);
d4c1522
 const char * nm_active_connection_get_master              (NMActiveConnection *connection);
d4c1522
+gboolean       nm_active_connection_get_default           (NMActiveConnection *connection);
d4c1522
+NMIP4Config *  nm_active_connection_get_ip4_config        (NMActiveConnection *connection);
d4c1522
+NMDHCP4Config *nm_active_connection_get_dhcp4_config      (NMActiveConnection *connection);
d4c1522
+gboolean       nm_active_connection_get_default6          (NMActiveConnection *connection);
d4c1522
+NMIP6Config *  nm_active_connection_get_ip6_config        (NMActiveConnection *connection);
d4c1522
+NMDHCP6Config *nm_active_connection_get_dhcp6_config      (NMActiveConnection *connection);
d4c1522
 
d4c1522
 G_END_DECLS
d4c1522
 
d4c1522
diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c
d4c1522
index d4f95ac..6d8e9f1 100644
d4c1522
--- a/libnm-glib/nm-device.c
d4c1522
+++ b/libnm-glib/nm-device.c
d4c1522
@@ -1253,6 +1253,10 @@ nm_device_get_firmware_missing (NMDevice *device)
d4c1522
  *
d4c1522
  * Gets the current #NMIP4Config associated with the #NMDevice.
d4c1522
  *
d4c1522
+ * Note that as of NetworkManager 0.9.10, you can alternatively use
d4c1522
+ * nm_active_connection_get_ip4_config(), which also works with VPN
d4c1522
+ * connections.
d4c1522
+ *
d4c1522
  * Returns: (transfer none): the #NMIP4Config or %NULL if the device is not activated.
d4c1522
  **/
d4c1522
 NMIP4Config *
d4c1522
@@ -1270,6 +1274,10 @@ nm_device_get_ip4_config (NMDevice *device)
d4c1522
  *
d4c1522
  * Gets the current #NMDHCP4Config associated with the #NMDevice.
d4c1522
  *
d4c1522
+ * Note that as of NetworkManager 0.9.10, you can alternatively use
d4c1522
+ * nm_active_connection_get_dhcp4_config(), which also works with VPN
d4c1522
+ * connections.
d4c1522
+ *
d4c1522
  * Returns: (transfer none): the #NMDHCP4Config or %NULL if the device is not activated or not
d4c1522
  * using DHCP.
d4c1522
  **/
d4c1522
@@ -1288,6 +1296,10 @@ nm_device_get_dhcp4_config (NMDevice *device)
d4c1522
  *
d4c1522
  * Gets the current #NMIP6Config associated with the #NMDevice.
d4c1522
  *
d4c1522
+ * Note that as of NetworkManager 0.9.10, you can alternatively use
d4c1522
+ * nm_active_connection_get_ip6_config(), which also works with VPN
d4c1522
+ * connections.
d4c1522
+ *
d4c1522
  * Returns: (transfer none): the #NMIP6Config or %NULL if the device is not activated.
d4c1522
  **/
d4c1522
 NMIP6Config *
d4c1522
@@ -1305,6 +1317,10 @@ nm_device_get_ip6_config (NMDevice *device)
d4c1522
  *
d4c1522
  * Gets the current #NMDHCP6Config associated with the #NMDevice.
d4c1522
  *
d4c1522
+ * Note that as of NetworkManager 0.9.10, you can alternatively use
d4c1522
+ * nm_active_connection_get_dhcp6_config(), which also works with VPN
d4c1522
+ * connections.
d4c1522
+ *
d4c1522
  * Returns: (transfer none): the #NMDHCP6Config or %NULL if the device is not activated or not
d4c1522
  * using DHCP.
d4c1522
  **/
d4c1522
-- 
d4c1522
1.7.11.7
d4c1522
d4c1522
d4c1522
From f1f4f32c02e724f59fcc958d08ab8d543a01311d Mon Sep 17 00:00:00 2001
d4c1522
From: Dan Winship <danw@gnome.org>
d4c1522
Date: Wed, 18 Dec 2013 11:49:39 -0500
d4c1522
Subject: [PATCH 4/4] cli: get IP/DHCP config directly from the
d4c1522
 NMActiveConnection (rh #1036132)
d4c1522
MIME-Version: 1.0
d4c1522
Content-Type: text/plain; charset=UTF-8
d4c1522
Content-Transfer-Encoding: 8bit
d4c1522
d4c1522
Now that NMActiveConnection has IP and DHCP config info, use that
d4c1522
directly in "nmcli con show active" rather than getting it from the
d4c1522
connection's device; this way, we get the right info for VPN
d4c1522
connections as well.
d4c1522
d4c1522
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
d4c1522
---
d4c1522
 cli/src/connections.c | 60 ++++++++++++++-------------------------------------
d4c1522
 1 file changed, 16 insertions(+), 44 deletions(-)
d4c1522
d4c1522
diff --git a/cli/src/connections.c b/cli/src/connections.c
d4c1522
index 26be72f..7376405 100644
d4c1522
--- a/cli/src/connections.c
d4c1522
+++ b/cli/src/connections.c
d4c1522
@@ -941,66 +941,38 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc)
d4c1522
 
d4c1522
 		/* IP4 */
d4c1522
 		if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name,  nmc_fields_con_active_details_groups[1].name) == 0) {
d4c1522
-			const GPtrArray *devices;
d4c1522
-			int j;
d4c1522
+			gboolean b1 = FALSE;
d4c1522
+			NMIP4Config *cfg4 = nm_active_connection_get_ip4_config (acon);
d4c1522
 
d4c1522
-			devices = nm_active_connection_get_devices (acon);
d4c1522
-			for (j = 0; devices && (j < devices->len); j++) {
d4c1522
-				gboolean b1 = FALSE;
d4c1522
-				NMDevice *device = g_ptr_array_index (devices, j);
d4c1522
-				NMIP4Config *cfg4 = nm_device_get_ip4_config (device);
d4c1522
-
d4c1522
-				b1 = print_ip4_config (cfg4, nmc, "IP4", group_fld);
d4c1522
-				was_output = was_output || b1;
d4c1522
-			}
d4c1522
+			b1 = print_ip4_config (cfg4, nmc, "IP4", group_fld);
d4c1522
+			was_output = was_output || b1;
d4c1522
 		}
d4c1522
 
d4c1522
 		/* DHCP4 */
d4c1522
 		if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name,  nmc_fields_con_active_details_groups[2].name) == 0) {
d4c1522
-			const GPtrArray *devices;
d4c1522
-			int j;
d4c1522
+			gboolean b1 = FALSE;
d4c1522
+			NMDHCP4Config *dhcp4 = nm_active_connection_get_dhcp4_config (acon);
d4c1522
 
d4c1522
-			devices = nm_active_connection_get_devices (acon);
d4c1522
-			for (j = 0; devices && (j < devices->len); j++) {
d4c1522
-				gboolean b1 = FALSE;
d4c1522
-				NMDevice *device = g_ptr_array_index (devices, j);
d4c1522
-				NMDHCP4Config *dhcp4 = nm_device_get_dhcp4_config (device);
d4c1522
-
d4c1522
-				b1 = print_dhcp4_config (dhcp4, nmc, "DHCP4", group_fld);
d4c1522
-				was_output = was_output || b1;
d4c1522
-			}
d4c1522
+			b1 = print_dhcp4_config (dhcp4, nmc, "DHCP4", group_fld);
d4c1522
+			was_output = was_output || b1;
d4c1522
 		}
d4c1522
 
d4c1522
 		/* IP6 */
d4c1522
 		if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name,  nmc_fields_con_active_details_groups[3].name) == 0) {
d4c1522
-			const GPtrArray *devices;
d4c1522
-			int j;
d4c1522
+			gboolean b1 = FALSE;
d4c1522
+			NMIP6Config *cfg6 = nm_active_connection_get_ip6_config (acon);
d4c1522
 
d4c1522
-			devices = nm_active_connection_get_devices (acon);
d4c1522
-			for (j = 0; devices && (j < devices->len); j++) {
d4c1522
-				gboolean b1 = FALSE;
d4c1522
-				NMDevice *device = g_ptr_array_index (devices, j);
d4c1522
-				NMIP6Config *cfg6 = nm_device_get_ip6_config (device);
d4c1522
-
d4c1522
-				b1 = print_ip6_config (cfg6, nmc, "IP6", group_fld);
d4c1522
-				was_output = was_output || b1;
d4c1522
-			}
d4c1522
+			b1 = print_ip6_config (cfg6, nmc, "IP6", group_fld);
d4c1522
+			was_output = was_output || b1;
d4c1522
 		}
d4c1522
 
d4c1522
 		/* DHCP6 */
d4c1522
 		if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name,  nmc_fields_con_active_details_groups[4].name) == 0) {
d4c1522
-			const GPtrArray *devices;
d4c1522
-			int j;
d4c1522
+			gboolean b1 = FALSE;
d4c1522
+			NMDHCP6Config *dhcp6 = nm_active_connection_get_dhcp6_config (acon);
d4c1522
 
d4c1522
-			devices = nm_active_connection_get_devices (acon);
d4c1522
-			for (j = 0; devices && (j < devices->len); j++) {
d4c1522
-				gboolean b1 = FALSE;
d4c1522
-				NMDevice *device = g_ptr_array_index (devices, j);
d4c1522
-				NMDHCP6Config *dhcp6 = nm_device_get_dhcp6_config (device);
d4c1522
-
d4c1522
-				b1 = print_dhcp6_config (dhcp6, nmc, "DHCP6", group_fld);
d4c1522
-				was_output = was_output || b1;
d4c1522
-			}
d4c1522
+			b1 = print_dhcp6_config (dhcp6, nmc, "DHCP6", group_fld);
d4c1522
+			was_output = was_output || b1;
d4c1522
 		}
d4c1522
 
d4c1522
 		/* VPN */
d4c1522
-- 
d4c1522
1.7.11.7
d4c1522