summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2022-08-24 16:50:14 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2022-08-24 17:20:18 +0200
commit4f552f53bb44786a85a1254ce82c2c50eb5fb780 (patch)
tree830695d84170ace46baa8eadb0cfca8acfadbe67
parent711f69fb738a253674149eb302108dc688181190 (diff)
downloadNetworkManager-4f552f53bb44786a85a1254ce82c2c50eb5fb780.tar.gz
core: log when dynamic IP configuration is restarted and why
-rw-r--r--src/core/devices/nm-device-ethernet.c2
-rw-r--r--src/core/devices/nm-device.c10
-rw-r--r--src/core/devices/nm-device.h2
-rw-r--r--src/core/devices/wifi/nm-device-wifi.c4
-rw-r--r--src/core/nm-manager.c2
5 files changed, 11 insertions, 9 deletions
diff --git a/src/core/devices/nm-device-ethernet.c b/src/core/devices/nm-device-ethernet.c
index 32f2fbf9b4..40c6d208e1 100644
--- a/src/core/devices/nm-device-ethernet.c
+++ b/src/core/devices/nm-device-ethernet.c
@@ -451,7 +451,7 @@ supplicant_auth_state_changed(NMSupplicantInterface *iface,
if (state == NM_SUPPLICANT_AUTH_STATE_SUCCESS) {
nm_clear_g_signal_handler(priv->supplicant.iface, &priv->supplicant.iface_state_id);
- nm_device_update_dynamic_ip_setup(NM_DEVICE(self));
+ nm_device_update_dynamic_ip_setup(NM_DEVICE(self), "supplicant auth state changed");
}
}
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c
index c51da9ac82..96b4a1d26b 100644
--- a/src/core/devices/nm-device.c
+++ b/src/core/devices/nm-device.c
@@ -6323,7 +6323,7 @@ _dev_unmanaged_check_external_down(NMDevice *self, gboolean only_if_unmanaged, g
}
void
-nm_device_update_dynamic_ip_setup(NMDevice *self)
+nm_device_update_dynamic_ip_setup(NMDevice *self, const char *reason)
{
NMDevicePrivate *priv;
@@ -6334,6 +6334,8 @@ nm_device_update_dynamic_ip_setup(NMDevice *self)
if (priv->state < NM_DEVICE_STATE_IP_CONFIG || priv->state > NM_DEVICE_STATE_ACTIVATED)
return;
+ _LOGD(LOGD_DEVICE, "restarting dynamic IP configuration (%s)", reason);
+
g_hash_table_remove_all(priv->ip6_saved_properties);
if (priv->ipdhcp_data_4.state != NM_DEVICE_IP_STATE_NONE)
@@ -6733,7 +6735,7 @@ device_link_changed(gpointer user_data)
/* Update DHCP, etc, if needed */
if (ip_ifname_changed)
- nm_device_update_dynamic_ip_setup(self);
+ nm_device_update_dynamic_ip_setup(self, "IP interface changed");
was_up = priv->up;
priv->up = NM_FLAGS_HAS(pllink->n_ifi_flags, IFF_UP);
@@ -6793,7 +6795,7 @@ device_link_changed(gpointer user_data)
* renew DHCP leases and such.
*/
if (priv->state == NM_DEVICE_STATE_ACTIVATED) {
- nm_device_update_dynamic_ip_setup(self);
+ nm_device_update_dynamic_ip_setup(self, "interface got carrier");
}
}
@@ -6855,7 +6857,7 @@ device_ip_link_changed(gpointer user_data)
priv->ip_iface_ = g_strdup(ip_iface);
update_prop_ip_iface(self);
- nm_device_update_dynamic_ip_setup(self);
+ nm_device_update_dynamic_ip_setup(self, "interface renamed");
}
return G_SOURCE_REMOVE;
diff --git a/src/core/devices/nm-device.h b/src/core/devices/nm-device.h
index 382c866053..de850e68f2 100644
--- a/src/core/devices/nm-device.h
+++ b/src/core/devices/nm-device.h
@@ -764,7 +764,7 @@ void nm_device_update_metered(NMDevice *self);
gboolean nm_device_update_hw_address(NMDevice *self);
void nm_device_update_initial_hw_address(NMDevice *self);
void nm_device_update_permanent_hw_address(NMDevice *self, gboolean force_freeze);
-void nm_device_update_dynamic_ip_setup(NMDevice *self);
+void nm_device_update_dynamic_ip_setup(NMDevice *self, const char *reason);
guint nm_device_get_supplicant_timeout(NMDevice *self);
gboolean nm_device_auth_retries_try_next(NMDevice *self);
diff --git a/src/core/devices/wifi/nm-device-wifi.c b/src/core/devices/wifi/nm-device-wifi.c
index 39c68d777f..43798b85ad 100644
--- a/src/core/devices/wifi/nm-device-wifi.c
+++ b/src/core/devices/wifi/nm-device-wifi.c
@@ -2520,7 +2520,7 @@ supplicant_iface_state(NMDeviceWifi *self,
_LOGD(LOGD_WIFI,
"supplicant state settled after roaming, renew dynamic IP configuration");
nm_clear_g_source_inst(&priv->roam_supplicant_wait_source);
- nm_device_update_dynamic_ip_setup(device);
+ nm_device_update_dynamic_ip_setup(device, "roamed to a different AP");
}
}
break;
@@ -2663,7 +2663,7 @@ supplicant_iface_notify_current_bss(NMSupplicantInterface *iface,
if (nm_supplicant_interface_get_state(priv->sup_iface)
== NM_SUPPLICANT_INTERFACE_STATE_COMPLETED) {
- nm_device_update_dynamic_ip_setup(NM_DEVICE(self));
+ nm_device_update_dynamic_ip_setup(NM_DEVICE(self), "roamed to a different AP");
} else {
/* Wait that the authentication to new the AP completes before
* trying to renew, otherwise the DHCP REQUEST could be lost
diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c
index 3af24aa00b..822df7ad3b 100644
--- a/src/core/nm-manager.c
+++ b/src/core/nm-manager.c
@@ -6580,7 +6580,7 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed)
&& !nm_device_get_unmanaged_flags(device, NM_UNMANAGED_SLEEPING)) {
/* DHCP leases of software devices could have gone stale
* so we need to renew them. */
- nm_device_update_dynamic_ip_setup(device);
+ nm_device_update_dynamic_ip_setup(device, "wake up");
continue;
}