From 2e103ea835af58659fc25149bc4b86a1dc8135f8 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Thu, 1 Sep 2016 13:00:21 +0200
Subject: [PATCH 1/4] dbus: fix emitting D-Bus NetworkManager's old-style
PropertiesChange signal
Before switching to gdbus (before 1.2.0), NetworkManager used dbus-glib.
Most objects in the D-Bus API with properties had a signal
NetworkManager-specific "PropertiesChanged" signal. Nowadays, this way of
handling of property changes is deprecated for the common "PropertiesChanged"
signal on the "org.freedesktop.DBus.Properties" interface.
There were a few pecularities in 1.0.0 and earlier:
(1) Due to the implementation with dbus-glib, a property-changed
signal was emitted on *all* interfaces. For example:
- a change on a NMDeviceVeth of "NMDeviceEthernet.HwAddress" would be
emitted both for the interfaces "fdo.NM.Device.Ethernet" and
"fdo.NM.Device.Veth". Note that NMDeviceVeth is derived from
NMDeviceEthernet and there is no "HwAddress" on veth device.
- a change of "NMVpnConnection.VpnState" was emitted on both
interfaces "fdo.NM.VPN.Connection" and "fdo.NM.Connecion.Active".
Note that NMActiveConnection is the parent type of NMVpnConnection and
only the latter has a property "VpnState".
(2) NMDevice's "fdo.NM.Device" interface doesn't have a "PropertiesChanged"
signal. From (1) follows that all property-changes for this type were instead
invoked with an interface like "fdo.NM.Device.Ethernet" (or multiple
interfaces in case of NMDeviceVeth).
1.2.0 introduced gdbus, which gives us the standard "fdo.DBus.Properties"
signal. However, it made the mistake of not realizing (1), thus instead
of emitting the signal once for each interface, it would pick the first
one in the inheritance tree.
With 1.4.0, a bug from merge commit 844345e caused signals for devices
to be only emitted for the interface "fdo.NM.Device.Statistics", instead
of "fdo.NM.Device.Ethernet" or "fdo.NM.Device.Veth" (or both).
The latter is what bgo#770629 is about and what commit 82e9439 tried to fix.
However, the fix was wrong because it tried to do the theoretically correct
thing of emitting the property-changed signal exactly once for the
interface that actually ontains the property. In addition, it missed that
NMDevice doesn't have a PropertiesChanged signal, which caused signals for
"fdo.NM.Device" to get lost *sigh*.
Now, restore the (broken) behavior of 1.0.0. These old-style property changed
signals are anyway considered deprecated and exist solely to satisfy old clients
and preserve the old API.
Fixes: 63fbfad3705db5901e6a2a6a2fc332da0f0ae4be
https://bugzilla.gnome.org/show_bug.cgi?id=770629
https://bugzilla.redhat.com/show_bug.cgi?id=1371920
(cherry picked from commit bef26a2e69f51259095fa080221db73de09fd38d)
(cherry picked from commit c29ca9b8760749ddd81b21e147c05403b9bd9561)
---
src/nm-exported-object.c | 79 ++++++++++++++++++++++++++++++++++++++++--------
src/nm-iface-helper.c | 14 +++++++++
2 files changed, 81 insertions(+), 12 deletions(-)
diff --git a/src/nm-exported-object.c b/src/nm-exported-object.c
index d99a9ce..5dacb02 100644
--- a/src/nm-exported-object.c
+++ b/src/nm-exported-object.c
@@ -27,6 +27,10 @@
#include "nm-bus-manager.h"
+#include "nm-device.h"
+#include "nm-active-connection.h"
+#include "nmdbus-device-statistics.h"
+
#if NM_MORE_ASSERTS >= 2
#define _ASSERT_NO_EARLY_EXPORT
#endif
@@ -267,8 +271,8 @@ nm_exported_object_class_add_interface (NMExportedObjectClass *object_class,
nm_exported_object_class_info_quark (), classinfo);
}
- classinfo->skeleton_types = g_slist_append (classinfo->skeleton_types,
- GSIZE_TO_POINTER (dbus_skeleton_type));
+ classinfo->skeleton_types = g_slist_prepend (classinfo->skeleton_types,
+ GSIZE_TO_POINTER (dbus_skeleton_type));
/* Ensure @dbus_skeleton_type's class_init has run, so its signals/properties
* will be defined.
@@ -499,6 +503,9 @@ nm_exported_object_create_skeletons (NMExportedObject *self,
}
nm_assert (i == 0);
+ /* The list of interfaces priv->interfaces is to be sorted from parent-class to derived-class.
+ * On the other hand, if one class defines multiple interfaces, the interfaces are sorted in
+ * the order of calls to nm_exported_object_class_add_interface(). */
if (priv->num_interfaces > 0) {
memcpy (&interfaces[num_interfaces], priv->interfaces, sizeof (InterfaceData) * priv->num_interfaces);
g_slice_free1 (sizeof (InterfaceData) * priv->num_interfaces, priv->interfaces);
@@ -801,12 +808,11 @@ idle_emit_properties_changed (gpointer self)
if (n == 0)
continue;
- if (!ifdata->property_changed_signal_id)
- goto next;
+ nm_assert (ifdata->property_changed_signal_id);
/* We use here alloca in a loop, something that is usually avoided.
* But the number of interfaces "priv->num_interfaces" is small (determined by
- * the depth of the type inheritence) and the number of possible pending_notifies
+ * the depth of the type inheritance) and the number of possible pending_notifies
* "n" is small (determined by the number of GObject properties). */
values = g_alloca (sizeof (values[0]) * n);
@@ -834,7 +840,6 @@ idle_emit_properties_changed (gpointer self)
g_signal_emit (ifdata->interface, ifdata->property_changed_signal_id, 0, variant);
-next:
g_hash_table_remove_all (ifdata->pending_notifies);
}
@@ -844,15 +849,21 @@ next:
static void
nm_exported_object_notify (GObject *object, GParamSpec *pspec)
{
+ NMExportedObject *self = (NMExportedObject *) object;
NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (object);
NMExportedObjectClassInfo *classinfo;
GType type;
const char *dbus_property_name = NULL;
GValue value = G_VALUE_INIT;
+ GVariant *value_variant;
InterfaceData *ifdata = NULL;
const GVariantType *vtype;
guint i, j;
+ /* Hook to emit deprecated "PropertiesChanged" signal on NetworkManager interfaces.
+ * This is to preserve deprecated D-Bus API, nowadays we use instead
+ * the "PropertiesChanged" signal of "org.freedesktop.DBus.Properties". */
+
if (priv->num_interfaces == 0)
return;
@@ -888,14 +899,58 @@ nm_exported_object_notify (GObject *object, GParamSpec *pspec)
vtype_found:
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (object), pspec->name, &value);
-
- /* @dbus_property_name is inside classinfo and never freed, thus we don't clone it.
- * Also, we do a pointer, not string comparison. */
- g_hash_table_insert (ifdata->pending_notifies,
- (gpointer) dbus_property_name,
- g_dbus_gvalue_to_gvariant (&value, vtype));
+ value_variant = g_dbus_gvalue_to_gvariant (&value, vtype);
g_value_unset (&value);
+ if ( ( NM_IS_DEVICE (self)
+ && !NMDBUS_IS_DEVICE_STATISTICS_SKELETON (ifdata->interface))
+ || NM_IS_ACTIVE_CONNECTION (self)) {
+ /* This PropertiesChanged signal is nodaways deprecated in favor
+ * of "org.freedesktop.DBus.Properties"'s PropertiesChanged signal.
+ * This function solely exists to raise the NM version of PropertiesChanged.
+ *
+ * With types exported on D-Bus that are implemented as derived
+ * types in glib (NMDevice and NMActiveConnection), multiple types
+ * in the inheritance tree define a "PropertiesChanged" signal.
+ *
+ * In 1.0.0 and earlier, the signal was emitted once for every interface
+ * that had a "PropertiesChanged" signal. For example:
+ * - NMDeviceEthernet.HwAddress was emitted on "fdo.NM.Device.Ethernet"
+ * and "fdo.NM.Device.Veth" (if the device was of type NMDeviceVeth).
+ * - NMVpnConnection.VpnState was emitted on "fdo.NM.Connecion.Active"
+ * and "fdo.NM.VPN.Connection".
+ *
+ * NMDevice is special in that it didn't have a "PropertiesChanged" signal.
+ * Thus, a change to "NMDevice.StateReason" would be emitted on "fdo.NM.Device.Ethernet"
+ * and also on "fdo.NM.Device.Veth" (in case of a device of type NMDeviceVeth).
+ *
+ * The releases of 1.2.0 and 1.4.0 failed to realize above and broke this behavior.
+ * This special handling here is to bring back the 1.0.0 behavior.
+ *
+ * The Device.Statistics signal is special, because it was only added with 1.4.0
+ * and didn't have above behavior. So let's save the overhead of emitting multiple
+ * deprecated signals for wrong interfaces. */
+ for (i = 0, j = 0; i < priv->num_interfaces; i++) {
+ ifdata = &priv->interfaces[i];
+ if ( ifdata->property_changed_signal_id
+ && !NMDBUS_IS_DEVICE_STATISTICS_SKELETON (ifdata->interface)) {
+ j++;
+ g_hash_table_insert (ifdata->pending_notifies,
+ (gpointer) dbus_property_name,
+ g_variant_ref (value_variant));
+ }
+ }
+ nm_assert (j > 0);
+ g_variant_unref (value_variant);
+ } else if (ifdata->property_changed_signal_id) {
+ /* @dbus_property_name is inside classinfo and never freed, thus we don't clone it.
+ * Also, we do a pointer, not string comparison. */
+ g_hash_table_insert (ifdata->pending_notifies,
+ (gpointer) dbus_property_name,
+ value_variant);
+ } else
+ nm_assert_not_reached ();
+
if (!priv->notify_idle_id)
priv->notify_idle_id = g_idle_add (idle_emit_properties_changed, object);
}
diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c
index 49672cf..de035f1 100644
--- a/src/nm-iface-helper.c
+++ b/src/nm-iface-helper.c
@@ -534,6 +534,8 @@ gboolean nm_config_get_configure_and_quit (gpointer unused);
gconstpointer nm_bus_manager_get (void);
void nm_bus_manager_register_object (gpointer unused, gpointer object);
void nm_bus_manager_unregister_object (gpointer unused, gpointer object);
+GType nm_device_get_type (void);
+GType nm_active_connection_get_type (void);
gconstpointer
nm_config_get (void)
@@ -569,3 +571,15 @@ nm_bus_manager_unregister_object (gpointer unused, gpointer object)
{
}
+GType
+nm_device_get_type (void)
+{
+ g_return_val_if_reached (0);
+}
+
+GType
+nm_active_connection_get_type (void)
+{
+ g_return_val_if_reached (0);
+}
+
--
2.7.4
From fcb1e69eafec59571ead5d771f89f7fa86dbb953 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Thu, 1 Sep 2016 13:38:20 +0200
Subject: [PATCH 2/4] dbus: deprecated NM specific PropertiesChanged signals
Nowadays, users should use the standard "PropertiesChanged" signal
on "org.freedesktop.DBus.Properties" interface.
(cherry picked from commit 6fb917178aa19c61e909957f5146aa4565e0cb2f)
(cherry picked from commit 98773bff54970db7e481a5f07fdcb11a4068a2b3)
---
introspection/nm-access-point.xml | 2 ++
introspection/nm-active-connection.xml | 2 ++
introspection/nm-checkpoint.xml | 2 ++
introspection/nm-device-adsl.xml | 2 ++
introspection/nm-device-bond.xml | 2 ++
introspection/nm-device-bridge.xml | 2 ++
introspection/nm-device-bt.xml | 2 ++
introspection/nm-device-ethernet.xml | 2 ++
introspection/nm-device-generic.xml | 2 ++
introspection/nm-device-infiniband.xml | 2 ++
introspection/nm-device-ip-tunnel.xml | 2 ++
introspection/nm-device-macvlan.xml | 2 ++
introspection/nm-device-modem.xml | 2 ++
introspection/nm-device-olpc-mesh.xml | 2 +-
introspection/nm-device-statistics.xml | 2 ++
introspection/nm-device-team.xml | 2 ++
introspection/nm-device-tun.xml | 2 ++
introspection/nm-device-veth.xml | 2 ++
introspection/nm-device-vlan.xml | 2 ++
introspection/nm-device-vxlan.xml | 2 ++
introspection/nm-device-wifi.xml | 4 ++--
introspection/nm-device-wimax.xml | 2 +-
introspection/nm-dhcp4-config.xml | 2 ++
introspection/nm-dhcp6-config.xml | 2 ++
introspection/nm-ip4-config.xml | 2 ++
introspection/nm-ip6-config.xml | 2 ++
introspection/nm-manager.xml | 2 +-
introspection/nm-settings-connection.xml | 2 ++
introspection/nm-settings.xml | 2 ++
introspection/nm-vpn-connection.xml | 2 ++
introspection/nm-wimax-nsp.xml | 2 ++
31 files changed, 59 insertions(+), 5 deletions(-)
diff --git a/introspection/nm-access-point.xml b/introspection/nm-access-point.xml
index 0c1ebf2..617c867 100644
--- a/introspection/nm-access-point.xml
+++ b/introspection/nm-access-point.xml
@@ -93,6 +93,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-active-connection.xml b/introspection/nm-active-connection.xml
index a4e9417..383ede3 100644
--- a/introspection/nm-active-connection.xml
+++ b/introspection/nm-active-connection.xml
@@ -148,6 +148,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-checkpoint.xml b/introspection/nm-checkpoint.xml
index d0fbda8..1c5050f 100644
--- a/introspection/nm-checkpoint.xml
+++ b/introspection/nm-checkpoint.xml
@@ -34,6 +34,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-adsl.xml b/introspection/nm-device-adsl.xml
index 5ad397e..0986f06 100644
--- a/introspection/nm-device-adsl.xml
+++ b/introspection/nm-device-adsl.xml
@@ -5,6 +5,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-bond.xml b/introspection/nm-device-bond.xml
index fc0249d..e6288a1 100644
--- a/introspection/nm-device-bond.xml
+++ b/introspection/nm-device-bond.xml
@@ -28,6 +28,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-bridge.xml b/introspection/nm-device-bridge.xml
index c2e8ffd..a6c5710 100644
--- a/introspection/nm-device-bridge.xml
+++ b/introspection/nm-device-bridge.xml
@@ -28,6 +28,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-bt.xml b/introspection/nm-device-bt.xml
index 6249085..f891220 100644
--- a/introspection/nm-device-bt.xml
+++ b/introspection/nm-device-bt.xml
@@ -28,6 +28,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-ethernet.xml b/introspection/nm-device-ethernet.xml
index ddfa74b..3aa4540 100644
--- a/introspection/nm-device-ethernet.xml
+++ b/introspection/nm-device-ethernet.xml
@@ -42,6 +42,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-generic.xml b/introspection/nm-device-generic.xml
index e79ff70..39aafc2 100644
--- a/introspection/nm-device-generic.xml
+++ b/introspection/nm-device-generic.xml
@@ -19,6 +19,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-infiniband.xml b/introspection/nm-device-infiniband.xml
index 9848a07..34b5fad 100644
--- a/introspection/nm-device-infiniband.xml
+++ b/introspection/nm-device-infiniband.xml
@@ -20,6 +20,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-ip-tunnel.xml b/introspection/nm-device-ip-tunnel.xml
index 45f3a3f..dda71e3 100644
--- a/introspection/nm-device-ip-tunnel.xml
+++ b/introspection/nm-device-ip-tunnel.xml
@@ -86,6 +86,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-macvlan.xml b/introspection/nm-device-macvlan.xml
index 876b685..e0b58ba 100644
--- a/introspection/nm-device-macvlan.xml
+++ b/introspection/nm-device-macvlan.xml
@@ -33,6 +33,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-modem.xml b/introspection/nm-device-modem.xml
index 1d4bd65..29eff68 100644
--- a/introspection/nm-device-modem.xml
+++ b/introspection/nm-device-modem.xml
@@ -5,6 +5,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-olpc-mesh.xml b/introspection/nm-device-olpc-mesh.xml
index b2ab126..3d6162f 100644
--- a/introspection/nm-device-olpc-mesh.xml
+++ b/introspection/nm-device-olpc-mesh.xml
@@ -27,7 +27,7 @@
PropertiesChanged:
@properties: A dictionary containing the FIXME: check changed parameters.
- Emitted when the wireless device's properties changed.
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-statistics.xml b/introspection/nm-device-statistics.xml
index bdb19c8..84c3b6f 100644
--- a/introspection/nm-device-statistics.xml
+++ b/introspection/nm-device-statistics.xml
@@ -29,6 +29,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-team.xml b/introspection/nm-device-team.xml
index 64faaec..c7b50a3 100644
--- a/introspection/nm-device-team.xml
+++ b/introspection/nm-device-team.xml
@@ -35,6 +35,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-tun.xml b/introspection/nm-device-tun.xml
index a11461c..68167cc 100644
--- a/introspection/nm-device-tun.xml
+++ b/introspection/nm-device-tun.xml
@@ -57,6 +57,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-veth.xml b/introspection/nm-device-veth.xml
index b064874..93c7c87 100644
--- a/introspection/nm-device-veth.xml
+++ b/introspection/nm-device-veth.xml
@@ -12,6 +12,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-vlan.xml b/introspection/nm-device-vlan.xml
index 7d8fbdc..e5bf7c4 100644
--- a/introspection/nm-device-vlan.xml
+++ b/introspection/nm-device-vlan.xml
@@ -34,6 +34,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-vxlan.xml b/introspection/nm-device-vxlan.xml
index ec17717..8eae63c 100644
--- a/introspection/nm-device-vxlan.xml
+++ b/introspection/nm-device-vxlan.xml
@@ -131,6 +131,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-wifi.xml b/introspection/nm-device-wifi.xml
index c1f378d..1973b41 100644
--- a/introspection/nm-device-wifi.xml
+++ b/introspection/nm-device-wifi.xml
@@ -93,9 +93,9 @@
<!--
PropertiesChanged:
- @properties: A dictionary containing the FIXME: check changed parameters.
+ @properties: A dictionary containing the changed parameters.
- Emitted when the wireless device's properties changed.
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-device-wimax.xml b/introspection/nm-device-wimax.xml
index 02539db..844856c 100644
--- a/introspection/nm-device-wimax.xml
+++ b/introspection/nm-device-wimax.xml
@@ -83,7 +83,7 @@
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values.
- Emitted when the WiMax device's properties changed.
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-dhcp4-config.xml b/introspection/nm-dhcp4-config.xml
index e9363f9..5244bca 100644
--- a/introspection/nm-dhcp4-config.xml
+++ b/introspection/nm-dhcp4-config.xml
@@ -19,6 +19,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-dhcp6-config.xml b/introspection/nm-dhcp6-config.xml
index 7ecdf35..09e2ca8 100644
--- a/introspection/nm-dhcp6-config.xml
+++ b/introspection/nm-dhcp6-config.xml
@@ -19,6 +19,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-ip4-config.xml b/introspection/nm-ip4-config.xml
index bbe7beb..17f57bc 100644
--- a/introspection/nm-ip4-config.xml
+++ b/introspection/nm-ip4-config.xml
@@ -94,6 +94,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-ip6-config.xml b/introspection/nm-ip6-config.xml
index a58bfff..e5cab71 100644
--- a/introspection/nm-ip6-config.xml
+++ b/introspection/nm-ip6-config.xml
@@ -86,6 +86,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-manager.xml b/introspection/nm-manager.xml
index 95cc16c..55d9dd2 100644
--- a/introspection/nm-manager.xml
+++ b/introspection/nm-manager.xml
@@ -425,7 +425,7 @@
PropertiesChanged:
@properties: The changed properties.
- NetworkManager's properties changed.
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-settings-connection.xml b/introspection/nm-settings-connection.xml
index 15b3803..cf33120 100644
--- a/introspection/nm-settings-connection.xml
+++ b/introspection/nm-settings-connection.xml
@@ -123,6 +123,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values.
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-settings.xml b/introspection/nm-settings.xml
index 7f5b546..32675e0 100644
--- a/introspection/nm-settings.xml
+++ b/introspection/nm-settings.xml
@@ -131,6 +131,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-vpn-connection.xml b/introspection/nm-vpn-connection.xml
index 430998f..897cea0 100644
--- a/introspection/nm-vpn-connection.xml
+++ b/introspection/nm-vpn-connection.xml
@@ -12,6 +12,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
diff --git a/introspection/nm-wimax-nsp.xml b/introspection/nm-wimax-nsp.xml
index 8b9a2fc..a766927 100644
--- a/introspection/nm-wimax-nsp.xml
+++ b/introspection/nm-wimax-nsp.xml
@@ -28,6 +28,8 @@
<!--
PropertiesChanged:
@properties: A dictionary mapping property names to variant boxed values.
+
+ DEPRECATED. Use the standard "PropertiesChanged" signal from "org.freedesktop.DBus.Properties" instead which exists since version NetworkManager 1.2.0.
-->
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
--
2.7.4
From b35b20aa1fe45cc62e3deb29b7d3b066cc79608a Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Thu, 1 Sep 2016 15:05:03 +0200
Subject: [PATCH 3/4] exported-object: use @self variable instead of @object
(cherry picked from commit b9c1868b451eb7ef92e6924ee8d3dcca0397865d)
(cherry picked from commit 7220d469bee845db63658acde49eed3b00954c58)
---
src/nm-exported-object.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/nm-exported-object.c b/src/nm-exported-object.c
index 5dacb02..c05161e 100644
--- a/src/nm-exported-object.c
+++ b/src/nm-exported-object.c
@@ -850,7 +850,7 @@ static void
nm_exported_object_notify (GObject *object, GParamSpec *pspec)
{
NMExportedObject *self = (NMExportedObject *) object;
- NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (object);
+ NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (self);
NMExportedObjectClassInfo *classinfo;
GType type;
const char *dbus_property_name = NULL;
@@ -867,7 +867,7 @@ nm_exported_object_notify (GObject *object, GParamSpec *pspec)
if (priv->num_interfaces == 0)
return;
- for (type = G_OBJECT_TYPE (object); type; type = g_type_parent (type)) {
+ for (type = G_OBJECT_TYPE (self); type; type = g_type_parent (type)) {
classinfo = g_type_get_qdata (type, nm_exported_object_class_info_quark ());
if (!classinfo)
continue;
@@ -878,7 +878,7 @@ nm_exported_object_notify (GObject *object, GParamSpec *pspec)
}
if (!dbus_property_name) {
nm_log_trace (LOGD_DBUS_PROPS, "properties-changed[%p]: ignoring notification for prop %s on type %s",
- object, pspec->name, G_OBJECT_TYPE_NAME (object));
+ self, pspec->name, G_OBJECT_TYPE_NAME (self));
return;
}
@@ -898,7 +898,7 @@ nm_exported_object_notify (GObject *object, GParamSpec *pspec)
vtype_found:
g_value_init (&value, pspec->value_type);
- g_object_get_property (G_OBJECT (object), pspec->name, &value);
+ g_object_get_property ((GObject *) self, pspec->name, &value);
value_variant = g_dbus_gvalue_to_gvariant (&value, vtype);
g_value_unset (&value);
@@ -952,7 +952,7 @@ vtype_found:
nm_assert_not_reached ();
if (!priv->notify_idle_id)
- priv->notify_idle_id = g_idle_add (idle_emit_properties_changed, object);
+ priv->notify_idle_id = g_idle_add (idle_emit_properties_changed, self);
}
/*****************************************************************************/
--
2.7.4
From bcb05b5eab46b31dea5c3067df1a2cc078a2eb32 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Thu, 1 Sep 2016 15:09:01 +0200
Subject: [PATCH 4/4] exported-object: use _NMLOG2() macro for logging
property-changed signal
(cherry picked from commit ba713e8381ee8276bee998b6ecaf263558fd6a4f)
(cherry picked from commit db4375277cc1611483ff53b16f016637467571b4)
---
src/nm-exported-object.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/nm-exported-object.c b/src/nm-exported-object.c
index c05161e..32b5ec0 100644
--- a/src/nm-exported-object.c
+++ b/src/nm-exported-object.c
@@ -76,11 +76,20 @@ G_DEFINE_QUARK (NMExportedObjectClassInfo, nm_exported_object_class_info)
#define _NMLOG_DOMAIN LOGD_CORE
#define _NMLOG(level, ...) \
- nm_log (level, _NMLOG_DOMAIN, \
+ nm_log ((level), _NMLOG_DOMAIN, \
"%s[%p]: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \
_NMLOG_PREFIX_NAME, (self) \
_NM_UTILS_MACRO_REST (__VA_ARGS__))
+#define _NMLOG2_PREFIX_NAME "properties-changed"
+#define _NMLOG2_DOMAIN LOGD_DBUS_PROPS
+
+#define _NMLOG2(level, ...) \
+ nm_log ((level), _NMLOG2_DOMAIN, \
+ "%s[%p]: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \
+ _NMLOG2_PREFIX_NAME, (self) \
+ _NM_UTILS_MACRO_REST (__VA_ARGS__))
+
/*****************************************************************************/
/* "AddConnectionUnsaved" -> "handle-add-connection-unsaved" */
@@ -830,12 +839,12 @@ idle_emit_properties_changed (gpointer self)
variant = g_variant_ref_sink (g_variant_builder_end (¬ifies));
- if (nm_logging_enabled (LOGL_DEBUG, LOGD_DBUS_PROPS)) {
+ if (_LOG2D_ENABLED ()) {
gs_free char *notification = g_variant_print (variant, TRUE);
- nm_log_dbg (LOGD_DBUS_PROPS, "properties-changed[%p]: type %s, iface %s: %s",
- self, G_OBJECT_TYPE_NAME (self), G_OBJECT_TYPE_NAME (ifdata->interface),
- notification);
+ _LOG2D ("type %s, iface %s: %s",
+ G_OBJECT_TYPE_NAME (self), G_OBJECT_TYPE_NAME (ifdata->interface),
+ notification);
}
g_signal_emit (ifdata->interface, ifdata->property_changed_signal_id, 0, variant);
@@ -877,8 +886,8 @@ nm_exported_object_notify (GObject *object, GParamSpec *pspec)
break;
}
if (!dbus_property_name) {
- nm_log_trace (LOGD_DBUS_PROPS, "properties-changed[%p]: ignoring notification for prop %s on type %s",
- self, pspec->name, G_OBJECT_TYPE_NAME (self));
+ _LOG2T ("ignoring notification for prop %s on type %s",
+ pspec->name, G_OBJECT_TYPE_NAME (self));
return;
}
--
2.7.4