summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-09-15 19:26:06 +0200
committerThomas Haller <thaller@redhat.com>2020-09-18 15:26:38 +0200
commit0a579fd16e07407426af55015d4365e6843ad3e5 (patch)
tree585c43f2334e7d7d4a2733428084583f632ae90c
parent479de883b3f5eed5bd9a37c057d6a7090bfe1630 (diff)
downloadNetworkManager-0a579fd16e07407426af55015d4365e6843ad3e5.tar.gz
device: return same singleton variant for NM_DEVICE_IP4_ADDRESS property
All our devices will return the same value on D-Bus: a "u" variant with zero value. Since NMDBusObject caches all the property values, we can share the instance.
-rw-r--r--src/devices/nm-device.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 5fc6c2a9df..bd14099015 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -17787,7 +17787,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_uint (value, (priv->capabilities & ~NM_DEVICE_CAP_INTERNAL_MASK));
break;
case PROP_IP4_ADDRESS:
- g_value_set_uint (value, 0);
+ g_value_set_variant (value, nm_g_variant_singleton_u_0 ());
break;
case PROP_CARRIER:
g_value_set_boolean (value, priv->carrier);
@@ -18500,10 +18500,11 @@ nm_device_class_init (NMDeviceClass *klass)
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS);
obj_properties[PROP_IP4_ADDRESS] =
- g_param_spec_uint (NM_DEVICE_IP4_ADDRESS, "", "",
- 0, G_MAXUINT32, 0, /* FIXME */
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
+ g_param_spec_variant (NM_DEVICE_IP4_ADDRESS, "", "",
+ G_VARIANT_TYPE_UINT32,
+ NULL,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
obj_properties[PROP_IP4_CONFIG] =
g_param_spec_string (NM_DEVICE_IP4_CONFIG, "", "",
NULL,