core: log when dynamic IP configuration is restarted and why

(cherry picked from commit 6cd69fde33)
This commit is contained in:
Beniamino Galvani 2022-08-24 16:50:14 +02:00 committed by Thomas Haller
parent 9d7e5a3b79
commit 2f8e4e2b06
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
5 changed files with 11 additions and 9 deletions

View file

@ -451,7 +451,7 @@ supplicant_auth_state_changed(NMSupplicantInterface *iface,
if (state == NM_SUPPLICANT_AUTH_STATE_SUCCESS) { if (state == NM_SUPPLICANT_AUTH_STATE_SUCCESS) {
nm_clear_g_signal_handler(priv->supplicant.iface, &priv->supplicant.iface_state_id); 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");
} }
} }

View file

@ -6332,7 +6332,7 @@ _dev_unmanaged_check_external_down(NMDevice *self, gboolean only_if_unmanaged, g
} }
void void
nm_device_update_dynamic_ip_setup(NMDevice *self) nm_device_update_dynamic_ip_setup(NMDevice *self, const char *reason)
{ {
NMDevicePrivate *priv; NMDevicePrivate *priv;
@ -6343,6 +6343,8 @@ nm_device_update_dynamic_ip_setup(NMDevice *self)
if (priv->state < NM_DEVICE_STATE_IP_CONFIG || priv->state > NM_DEVICE_STATE_ACTIVATED) if (priv->state < NM_DEVICE_STATE_IP_CONFIG || priv->state > NM_DEVICE_STATE_ACTIVATED)
return; return;
_LOGD(LOGD_DEVICE, "restarting dynamic IP configuration (%s)", reason);
g_hash_table_remove_all(priv->ip6_saved_properties); g_hash_table_remove_all(priv->ip6_saved_properties);
if (priv->ipdhcp_data_4.state != NM_DEVICE_IP_STATE_NONE) if (priv->ipdhcp_data_4.state != NM_DEVICE_IP_STATE_NONE)
@ -6742,7 +6744,7 @@ device_link_changed(gpointer user_data)
/* Update DHCP, etc, if needed */ /* Update DHCP, etc, if needed */
if (ip_ifname_changed) 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; was_up = priv->up;
priv->up = NM_FLAGS_HAS(pllink->n_ifi_flags, IFF_UP); priv->up = NM_FLAGS_HAS(pllink->n_ifi_flags, IFF_UP);
@ -6802,7 +6804,7 @@ device_link_changed(gpointer user_data)
* renew DHCP leases and such. * renew DHCP leases and such.
*/ */
if (priv->state == NM_DEVICE_STATE_ACTIVATED) { if (priv->state == NM_DEVICE_STATE_ACTIVATED) {
nm_device_update_dynamic_ip_setup(self); nm_device_update_dynamic_ip_setup(self, "interface got carrier");
} }
} }
@ -6864,7 +6866,7 @@ device_ip_link_changed(gpointer user_data)
priv->ip_iface_ = g_strdup(ip_iface); priv->ip_iface_ = g_strdup(ip_iface);
update_prop_ip_iface(self); 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; return G_SOURCE_REMOVE;

View file

@ -764,7 +764,7 @@ void nm_device_update_metered(NMDevice *self);
gboolean nm_device_update_hw_address(NMDevice *self); gboolean nm_device_update_hw_address(NMDevice *self);
void nm_device_update_initial_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_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); guint nm_device_get_supplicant_timeout(NMDevice *self);
gboolean nm_device_auth_retries_try_next(NMDevice *self); gboolean nm_device_auth_retries_try_next(NMDevice *self);

View file

@ -2520,7 +2520,7 @@ supplicant_iface_state(NMDeviceWifi *self,
_LOGD(LOGD_WIFI, _LOGD(LOGD_WIFI,
"supplicant state settled after roaming, renew dynamic IP configuration"); "supplicant state settled after roaming, renew dynamic IP configuration");
nm_clear_g_source_inst(&priv->roam_supplicant_wait_source); 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; break;
@ -2663,7 +2663,7 @@ supplicant_iface_notify_current_bss(NMSupplicantInterface *iface,
if (nm_supplicant_interface_get_state(priv->sup_iface) if (nm_supplicant_interface_get_state(priv->sup_iface)
== NM_SUPPLICANT_INTERFACE_STATE_COMPLETED) { == 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 { } else {
/* Wait that the authentication to new the AP completes before /* Wait that the authentication to new the AP completes before
* trying to renew, otherwise the DHCP REQUEST could be lost * trying to renew, otherwise the DHCP REQUEST could be lost

View file

@ -6580,7 +6580,7 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed)
&& !nm_device_get_unmanaged_flags(device, NM_UNMANAGED_SLEEPING)) { && !nm_device_get_unmanaged_flags(device, NM_UNMANAGED_SLEEPING)) {
/* DHCP leases of software devices could have gone stale /* DHCP leases of software devices could have gone stale
* so we need to renew them. */ * so we need to renew them. */
nm_device_update_dynamic_ip_setup(device); nm_device_update_dynamic_ip_setup(device, "wake up");
continue; continue;
} }