device: improve logging when changing IP configuration

nm_device_set_ip4_config() is called during cleanup and
from ip4_config_merge_and_apply(). The latter, has several
call sites.

It's not easy to track whether we called set_ip4_config with
or without commit (and if we call it without commit, we might
not see a logging line at all).

(same for nm_device_set_ip6_config()/ip6_config_merge_and_apply()).
This commit is contained in:
Thomas Haller 2016-04-15 20:07:02 +02:00
parent ba90c9601c
commit f50e39fc98

View file

@ -8063,6 +8063,9 @@ nm_device_set_ip4_config (NMDevice *self,
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
_LOGD (LOGD_IP4, "ip4-config: update (commit=%d, routes-full-sync=%d, new-config=%p)",
commit, routes_full_sync, new_config);
priv = NM_DEVICE_GET_PRIVATE (self);
ip_ifindex = nm_device_get_ip_ifindex (self);
@ -8096,7 +8099,7 @@ nm_device_set_ip4_config (NMDevice *self,
* this causes a re-read and reset. This should only happen for relevant changes */
nm_ip4_config_replace (old_config, new_config, &has_changes);
if (has_changes) {
_LOGD (LOGD_IP4, "update IP4Config instance (%s)",
_LOGD (LOGD_IP4, "ip4-config: update IP4Config instance (%s)",
nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config)));
}
} else {
@ -8106,13 +8109,13 @@ nm_device_set_ip4_config (NMDevice *self,
if (success && !nm_exported_object_is_exported (NM_EXPORTED_OBJECT (new_config)))
nm_exported_object_export (NM_EXPORTED_OBJECT (new_config));
_LOGD (LOGD_IP4, "set IP4Config instance (%s)",
_LOGD (LOGD_IP4, "ip4-config: set IP4Config instance (%s)",
nm_exported_object_get_path (NM_EXPORTED_OBJECT (new_config)));
}
} else if (old_config) {
has_changes = TRUE;
priv->ip4_config = NULL;
_LOGD (LOGD_IP4, "clear IP4Config instance (%s)",
_LOGD (LOGD_IP4, "ip4-config: clear IP4Config instance (%s)",
nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config)));
/* Device config is invalid if combined config is invalid */
g_clear_object (&priv->dev_ip4_config);
@ -8231,6 +8234,9 @@ nm_device_set_ip6_config (NMDevice *self,
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
_LOGD (LOGD_IP6, "ip6-config: update (commit=%d, routes-full-sync=%d, new-config=%p)",
commit, routes_full_sync, new_config);
priv = NM_DEVICE_GET_PRIVATE (self);
ip_ifindex = nm_device_get_ip_ifindex (self);
@ -8258,7 +8264,7 @@ nm_device_set_ip6_config (NMDevice *self,
* this causes a re-read and reset. This should only happen for relevant changes */
nm_ip6_config_replace (old_config, new_config, &has_changes);
if (has_changes) {
_LOGD (LOGD_IP6, "update IP6Config instance (%s)",
_LOGD (LOGD_IP6, "ip6-config: update IP6Config instance (%s)",
nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config)));
}
} else {
@ -8268,13 +8274,13 @@ nm_device_set_ip6_config (NMDevice *self,
if (success && !nm_exported_object_is_exported (NM_EXPORTED_OBJECT (new_config)))
nm_exported_object_export (NM_EXPORTED_OBJECT (new_config));
_LOGD (LOGD_IP6, "set IP6Config instance (%s)",
_LOGD (LOGD_IP6, "ip6-config: set IP6Config instance (%s)",
nm_exported_object_get_path (NM_EXPORTED_OBJECT (new_config)));
}
} else if (old_config) {
has_changes = TRUE;
priv->ip6_config = NULL;
_LOGD (LOGD_IP6, "clear IP6Config instance (%s)",
_LOGD (LOGD_IP6, "ip6-config: clear IP6Config instance (%s)",
nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config)));
}