From bef26a2e69f51259095fa080221db73de09fd38d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 1 Sep 2016 13:00:21 +0200 Subject: [PATCH 1/5] 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 --- 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 d99a9ceeb6..5dacb02003 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 49672cf565..de035f1a94 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); +} + From 6fb917178aa19c61e909957f5146aa4565e0cb2f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 1 Sep 2016 13:38:20 +0200 Subject: [PATCH 2/5] dbus: deprecated NM specific PropertiesChanged signals Nowadays, users should use the standard "PropertiesChanged" signal on "org.freedesktop.DBus.Properties" interface. --- 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 0c1ebf23ca..617c8671b6 100644 --- a/introspection/nm-access-point.xml +++ b/introspection/nm-access-point.xml @@ -93,6 +93,8 @@ diff --git a/introspection/nm-active-connection.xml b/introspection/nm-active-connection.xml index a4e9417041..383ede34a9 100644 --- a/introspection/nm-active-connection.xml +++ b/introspection/nm-active-connection.xml @@ -148,6 +148,8 @@ diff --git a/introspection/nm-checkpoint.xml b/introspection/nm-checkpoint.xml index d0fbda8dec..1c5050f279 100644 --- a/introspection/nm-checkpoint.xml +++ b/introspection/nm-checkpoint.xml @@ -34,6 +34,8 @@ diff --git a/introspection/nm-device-adsl.xml b/introspection/nm-device-adsl.xml index 5ad397e6a4..0986f06995 100644 --- a/introspection/nm-device-adsl.xml +++ b/introspection/nm-device-adsl.xml @@ -5,6 +5,8 @@ diff --git a/introspection/nm-device-bond.xml b/introspection/nm-device-bond.xml index fc0249d937..e6288a1530 100644 --- a/introspection/nm-device-bond.xml +++ b/introspection/nm-device-bond.xml @@ -28,6 +28,8 @@ diff --git a/introspection/nm-device-bridge.xml b/introspection/nm-device-bridge.xml index c2e8ffd3b3..a6c5710dc3 100644 --- a/introspection/nm-device-bridge.xml +++ b/introspection/nm-device-bridge.xml @@ -28,6 +28,8 @@ diff --git a/introspection/nm-device-bt.xml b/introspection/nm-device-bt.xml index 6249085b2e..f891220d25 100644 --- a/introspection/nm-device-bt.xml +++ b/introspection/nm-device-bt.xml @@ -28,6 +28,8 @@ diff --git a/introspection/nm-device-ethernet.xml b/introspection/nm-device-ethernet.xml index ddfa74bb09..3aa4540fb5 100644 --- a/introspection/nm-device-ethernet.xml +++ b/introspection/nm-device-ethernet.xml @@ -42,6 +42,8 @@ diff --git a/introspection/nm-device-generic.xml b/introspection/nm-device-generic.xml index e79ff700ac..39aafc2c1b 100644 --- a/introspection/nm-device-generic.xml +++ b/introspection/nm-device-generic.xml @@ -19,6 +19,8 @@ diff --git a/introspection/nm-device-infiniband.xml b/introspection/nm-device-infiniband.xml index 9848a07430..34b5fadd1f 100644 --- a/introspection/nm-device-infiniband.xml +++ b/introspection/nm-device-infiniband.xml @@ -20,6 +20,8 @@ diff --git a/introspection/nm-device-ip-tunnel.xml b/introspection/nm-device-ip-tunnel.xml index 45f3a3f710..dda71e3e67 100644 --- a/introspection/nm-device-ip-tunnel.xml +++ b/introspection/nm-device-ip-tunnel.xml @@ -86,6 +86,8 @@ diff --git a/introspection/nm-device-macvlan.xml b/introspection/nm-device-macvlan.xml index 876b685cc9..e0b58ba4da 100644 --- a/introspection/nm-device-macvlan.xml +++ b/introspection/nm-device-macvlan.xml @@ -33,6 +33,8 @@ diff --git a/introspection/nm-device-modem.xml b/introspection/nm-device-modem.xml index 1d4bd65ee9..29eff68246 100644 --- a/introspection/nm-device-modem.xml +++ b/introspection/nm-device-modem.xml @@ -5,6 +5,8 @@ diff --git a/introspection/nm-device-olpc-mesh.xml b/introspection/nm-device-olpc-mesh.xml index b2ab126ec6..3d6162f334 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. --> diff --git a/introspection/nm-device-statistics.xml b/introspection/nm-device-statistics.xml index bdb19c89ce..84c3b6fe47 100644 --- a/introspection/nm-device-statistics.xml +++ b/introspection/nm-device-statistics.xml @@ -29,6 +29,8 @@ diff --git a/introspection/nm-device-team.xml b/introspection/nm-device-team.xml index 64faaec4b0..c7b50a386d 100644 --- a/introspection/nm-device-team.xml +++ b/introspection/nm-device-team.xml @@ -35,6 +35,8 @@ diff --git a/introspection/nm-device-tun.xml b/introspection/nm-device-tun.xml index a11461c1a1..68167cc57d 100644 --- a/introspection/nm-device-tun.xml +++ b/introspection/nm-device-tun.xml @@ -57,6 +57,8 @@ diff --git a/introspection/nm-device-veth.xml b/introspection/nm-device-veth.xml index b064874e0d..93c7c87024 100644 --- a/introspection/nm-device-veth.xml +++ b/introspection/nm-device-veth.xml @@ -12,6 +12,8 @@ diff --git a/introspection/nm-device-vlan.xml b/introspection/nm-device-vlan.xml index 7d8fbdce92..e5bf7c44ed 100644 --- a/introspection/nm-device-vlan.xml +++ b/introspection/nm-device-vlan.xml @@ -34,6 +34,8 @@ diff --git a/introspection/nm-device-vxlan.xml b/introspection/nm-device-vxlan.xml index ec17717d6f..8eae63c647 100644 --- a/introspection/nm-device-vxlan.xml +++ b/introspection/nm-device-vxlan.xml @@ -131,6 +131,8 @@ diff --git a/introspection/nm-device-wifi.xml b/introspection/nm-device-wifi.xml index c1f378d8c0..1973b417dc 100644 --- a/introspection/nm-device-wifi.xml +++ b/introspection/nm-device-wifi.xml @@ -93,9 +93,9 @@ diff --git a/introspection/nm-device-wimax.xml b/introspection/nm-device-wimax.xml index 02539dbb66..844856cc19 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. --> diff --git a/introspection/nm-dhcp4-config.xml b/introspection/nm-dhcp4-config.xml index e9363f9e21..5244bcaaa0 100644 --- a/introspection/nm-dhcp4-config.xml +++ b/introspection/nm-dhcp4-config.xml @@ -19,6 +19,8 @@ diff --git a/introspection/nm-dhcp6-config.xml b/introspection/nm-dhcp6-config.xml index 7ecdf35cab..09e2ca8676 100644 --- a/introspection/nm-dhcp6-config.xml +++ b/introspection/nm-dhcp6-config.xml @@ -19,6 +19,8 @@ diff --git a/introspection/nm-ip4-config.xml b/introspection/nm-ip4-config.xml index bbe7bebeae..17f57bc685 100644 --- a/introspection/nm-ip4-config.xml +++ b/introspection/nm-ip4-config.xml @@ -94,6 +94,8 @@ diff --git a/introspection/nm-ip6-config.xml b/introspection/nm-ip6-config.xml index a58bfffa55..e5cab7132d 100644 --- a/introspection/nm-ip6-config.xml +++ b/introspection/nm-ip6-config.xml @@ -86,6 +86,8 @@ diff --git a/introspection/nm-manager.xml b/introspection/nm-manager.xml index beff406b8e..cf178c3951 100644 --- a/introspection/nm-manager.xml +++ b/introspection/nm-manager.xml @@ -426,7 +426,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. --> diff --git a/introspection/nm-settings-connection.xml b/introspection/nm-settings-connection.xml index 15b380348c..cf33120ce8 100644 --- a/introspection/nm-settings-connection.xml +++ b/introspection/nm-settings-connection.xml @@ -123,6 +123,8 @@ diff --git a/introspection/nm-settings.xml b/introspection/nm-settings.xml index 7f5b546c58..32675e02d8 100644 --- a/introspection/nm-settings.xml +++ b/introspection/nm-settings.xml @@ -131,6 +131,8 @@ diff --git a/introspection/nm-vpn-connection.xml b/introspection/nm-vpn-connection.xml index 430998f3d1..897cea0b0a 100644 --- a/introspection/nm-vpn-connection.xml +++ b/introspection/nm-vpn-connection.xml @@ -12,6 +12,8 @@ diff --git a/introspection/nm-wimax-nsp.xml b/introspection/nm-wimax-nsp.xml index 8b9a2fcc9f..a766927943 100644 --- a/introspection/nm-wimax-nsp.xml +++ b/introspection/nm-wimax-nsp.xml @@ -28,6 +28,8 @@ From b9c1868b451eb7ef92e6924ee8d3dcca0397865d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 1 Sep 2016 15:05:03 +0200 Subject: [PATCH 3/5] exported-object: use @self variable instead of @object --- 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 5dacb02003..c05161ea16 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); } /*****************************************************************************/ From ba713e8381ee8276bee998b6ecaf263558fd6a4f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 1 Sep 2016 15:09:01 +0200 Subject: [PATCH 4/5] exported-object: use _NMLOG2() macro for logging property-changed signal --- 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 c05161ea16..32b5ec05dd 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; } From 56bd86fd0cb0fb0719d0beafaa5cf091ccdac8b7 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 2 Sep 2016 10:51:22 +0200 Subject: [PATCH 5/5] NEWS: update file with changes to PropertiesChanged signal --- NEWS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/NEWS b/NEWS index c5950d390b..77b7463b1f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,13 @@ +============================================ +NetworkManager-1.6 +Overview of changes since NetworkManager-1.4 +============================================ + +This is a new stable release of NetworkManager. Notable changes include: + +* Fix emission of NM-style PropertiesChanged signals and deprecate them + for PropertiesChanged on "org.freedesktop.DBus.Properties" interface. + ============================================ NetworkManager-1.4 Overview of changes since NetworkManager-1.2