policy: unify logs formatting to use NM_HASH_OBFUSCATE_PTR

Having these hashes around are really useful when debugging issues. In
nm-policy we were using the pointer directly which is wrong as they are
not used in other places.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2133
This commit is contained in:
Fernando Fernandez Mancera
2025-02-10 12:53:26 +01:00
parent a1c05d2ce6
commit 077ffcc0ea

View File

@@ -2211,8 +2211,10 @@ device_state_changed(NMDevice *device,
con_v = nm_settings_connection_get_last_secret_agent_version_id(sett_conn); con_v = nm_settings_connection_get_last_secret_agent_version_id(sett_conn);
if (con_v == 0 || con_v == nm_agent_manager_get_agent_version_id(priv->agent_mgr)) { if (con_v == 0 || con_v == nm_agent_manager_get_agent_version_id(priv->agent_mgr)) {
_LOGD(LOGD_DEVICE, _LOGD(LOGD_DEVICE,
"block-autoconnect: connection '%s' now blocked from autoconnect due to " "block-autoconnect: connection[" NM_HASH_OBFUSCATE_PTR_FMT
"no secrets", "] (%s) now blocked from "
"autoconnect due to no secrets",
NM_HASH_OBFUSCATE_PTR(sett_conn),
nm_settings_connection_get_id(sett_conn)); nm_settings_connection_get_id(sett_conn));
nm_settings_connection_autoconnect_blocked_reason_set( nm_settings_connection_autoconnect_blocked_reason_set(
sett_conn, sett_conn,
@@ -2230,10 +2232,10 @@ device_state_changed(NMDevice *device,
* be marked as blocked when it fails with dependency-failed. * be marked as blocked when it fails with dependency-failed.
*/ */
_LOGD(LOGD_DEVICE, _LOGD(LOGD_DEVICE,
"block-autoconnect: connection[%p] (%s) now blocked from autoconnect due to " "block-autoconnect: connection[" NM_HASH_OBFUSCATE_PTR_FMT
"failed " "] (%s) now blocked "
"dependency", "from autoconnect due to failed dependency",
sett_conn, NM_HASH_OBFUSCATE_PTR(sett_conn),
nm_settings_connection_get_id(sett_conn)); nm_settings_connection_get_id(sett_conn));
nm_manager_devcon_autoconnect_blocked_reason_set( nm_manager_devcon_autoconnect_blocked_reason_set(
priv->manager, priv->manager,
@@ -2255,16 +2257,17 @@ device_state_changed(NMDevice *device,
/* blocked */ /* blocked */
} else if (tries != NM_AUTOCONNECT_RETRIES_FOREVER) { } else if (tries != NM_AUTOCONNECT_RETRIES_FOREVER) {
_LOGD(LOGD_DEVICE, _LOGD(LOGD_DEVICE,
"autoconnect: connection[%p] (%s): failed to autoconnect; %u tries left", "autoconnect: connection[" NM_HASH_OBFUSCATE_PTR_FMT "] (%s): failed to "
sett_conn, "autoconnect; %u tries left",
NM_HASH_OBFUSCATE_PTR(sett_conn),
nm_settings_connection_get_id(sett_conn), nm_settings_connection_get_id(sett_conn),
tries - 1u); tries - 1u);
_connection_autoconnect_retries_set(self, device, sett_conn, tries - 1u); _connection_autoconnect_retries_set(self, device, sett_conn, tries - 1u);
} else { } else {
_LOGD(LOGD_DEVICE, _LOGD(LOGD_DEVICE,
"autoconnect: connection[%p] (%s) failed to autoconnect; infinite tries " "autoconnect: connection[" NM_HASH_OBFUSCATE_PTR_FMT "] (%s) failed to "
"left", "autoconnect; infinite tries left",
sett_conn, NM_HASH_OBFUSCATE_PTR(sett_conn),
nm_settings_connection_get_id(sett_conn)); nm_settings_connection_get_id(sett_conn));
} }
} }