From 862177f6b655ec027c4bdb0826040de1bb5d86d6 Mon Sep 17 00:00:00 2001 From: Francesco Giudici Date: Mon, 29 Jul 2019 17:43:18 +0200 Subject: [PATCH] dhcp: log the dhcp options got in the lease once for all plugin Each plugin logged the options: just do that on dhcp state change and do in common code. Log the options at INFO level for all the plugins. This partially reverts the effects on the internal plugin of the commit: 97ce488f5f50 ('dhcp/internal: decrease logging level when retrieving dhcp options') --- src/dhcp/nm-dhcp-client.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/dhcp/nm-dhcp-client.c b/src/dhcp/nm-dhcp-client.c index 56660ff796..b9c673ddad 100644 --- a/src/dhcp/nm-dhcp-client.c +++ b/src/dhcp/nm-dhcp-client.c @@ -406,6 +406,17 @@ nm_dhcp_client_set_state (NMDhcpClient *self, if ((priv->state == new_state) && (new_state != NM_DHCP_STATE_BOUND)) return; + if (_LOGI_ENABLED ()) { + gs_free const char **keys = NULL; + guint i, nkeys; + + keys = nm_utils_strdict_get_keys (options, TRUE, &nkeys); + for (i = 0; i < nkeys; i++) { + _LOGI ("option %-20s => '%s'", keys[i], + (char *) g_hash_table_lookup (options, keys[i])); + } + } + if ( priv->addr_family == AF_INET6 && new_state == NM_DHCP_STATE_BOUND) { char *start, *iaid; @@ -840,15 +851,6 @@ nm_dhcp_client_handle_event (gpointer unused, g_variant_unref (value); } - if (nm_logging_enabled (LOGL_DEBUG, LOGD_DHCP6)) { - GHashTableIter hash_iter; - gpointer key, val; - - g_hash_table_iter_init (&hash_iter, str_options); - while (g_hash_table_iter_next (&hash_iter, &key, &val)) - _LOGD ("option '%s'=>'%s'", (const char *) key, (const char *) val); - } - /* Create the IP config */ if (g_hash_table_size (str_options) > 0) { if (priv->addr_family == AF_INET) {