device: break deprecated "Ip4Address" D-Bus property of Device interface

The "Ip4Address" property of "org.freedesktop.NetworkManager.Device"
interface is deprecated since version 0.9.9.1 (2013). Also, the property
is not exposed by libnm and generally not useful.

Drop the code to maintain it. The property still exists but always
returns 0 (0.0.0.0).
This commit is contained in:
Thomas Haller 2020-09-15 19:09:21 +02:00
parent 535fb95745
commit 72d6062cb0
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
3 changed files with 4 additions and 33 deletions

2
NEWS
View file

@ -15,6 +15,8 @@ USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
setting and runtime detection.
"resolvconf" and "netconfig" are only considered iff NetworkManager
was built with the respective options enabled.
* The long deprecated D-Bus property "Ip4Address" on "org.freedesktop.NetworkManager.Device"
interface is not defunct and always returns zero.
=============================================
NetworkManager-1.26

View file

@ -100,7 +100,7 @@
Ip4Address:
DEPRECATED; use the 'Addresses' property of the 'Ip4Config' object
instead.
instead. This property always returns 0.0.0.0 (numeric 0) as address.
-->
<property name="Ip4Address" type="u" access="read"/>

View file

@ -377,8 +377,6 @@ typedef struct _NMDevicePrivate {
GCancellable *deactivating_cancellable;
guint32 ip4_address;
NMActRequest * queued_act_request;
bool queued_act_request_is_waiting_for_carrier:1;
NMDBusTrackObjPath act_request;
@ -12300,24 +12298,6 @@ dnsmasq_cleanup (NMDevice *self)
priv->dnsmasq_manager = NULL;
}
static void
_update_ip4_address (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
const NMPlatformIP4Address *address;
g_return_if_fail (NM_IS_DEVICE (self));
if ( priv->ip_config_4
&& ip_config_valid (priv->state)
&& (address = nm_ip4_config_get_first_address (priv->ip_config_4))) {
if (address->address != priv->ip4_address) {
priv->ip4_address = address->address;
_notify (self, PROP_IP4_ADDRESS);
}
}
}
gboolean
nm_device_is_nm_owned (NMDevice *self)
{
@ -13749,9 +13729,6 @@ nm_device_set_ip_config (NMDevice *self,
if (has_changes) {
if (IS_IPv4)
_update_ip4_address (self);
if (old_config != priv->ip_config_x[IS_IPv4])
_notify (self, IS_IPv4 ? PROP_IP4_CONFIG : PROP_IP6_CONFIG);
@ -14276,8 +14253,6 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware)
/* Can only get HW address of some devices when they are up */
nm_device_update_hw_address (self);
_update_ip4_address (self);
/* when the link comes up, we must restore IP configuration if necessary. */
if (priv->ip_state_4 == NM_DEVICE_IP_STATE_DONE) {
if (!ip_config_merge_and_apply (self, AF_INET, TRUE))
@ -15999,12 +15974,6 @@ _cleanup_generic_post (NMDevice *self, CleanupType cleanup_type)
act_request_set (self, NULL);
}
/* Clear legacy IPv4 address property */
if (priv->ip4_address) {
priv->ip4_address = 0;
_notify (self, PROP_IP4_ADDRESS);
}
if (cleanup_type == CLEANUP_TYPE_DECONFIGURE) {
/* Check if the device was deactivated, and if so, delete_link.
* Don't call delete_link synchronously because we are currently
@ -17818,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, priv->ip4_address);
g_value_set_uint (value, 0);
break;
case PROP_CARRIER:
g_value_set_boolean (value, priv->carrier);