summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/dhcp/nm-dhcp-client.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/core/dhcp/nm-dhcp-client.c b/src/core/dhcp/nm-dhcp-client.c
index f5047244ed..916f933754 100644
--- a/src/core/dhcp/nm-dhcp-client.c
+++ b/src/core/dhcp/nm-dhcp-client.c
@@ -20,6 +20,7 @@
#include "NetworkManagerUtils.h"
#include "nm-utils.h"
#include "nm-dhcp-utils.h"
+#include "nm-dhcp-options.h"
#include "platform/nm-platform.h"
#include "nm-dhcp-client-logging.h"
@@ -462,23 +463,34 @@ nm_dhcp_client_set_state(NMDhcpClient *self,
&& !NM_IN_SET(new_state, NM_DHCP_STATE_BOUND, NM_DHCP_STATE_EXTENDED))
return;
- if (_LOGI_ENABLED()) {
+ if (_LOGD_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]));
+ _LOGD("option %-20s => '%s'", keys[i], (char *) g_hash_table_lookup(options, keys[i]));
}
}
- if (priv->addr_family == AF_INET6)
+ if (priv->addr_family == AF_INET6) {
event_id = nm_dhcp_utils_get_dhcp6_event_id(options);
+ _LOGT("event-id: %s%s%s",
+ NM_PRINT_FMT_QUOTED(event_id, ", event ID=\"", event_id, "\"", ""));
+ }
- _LOGI("state changed %s -> %s%s%s%s",
- state_to_string(priv->state),
- state_to_string(new_state),
- NM_PRINT_FMT_QUOTED(event_id, ", event ID=\"", event_id, "\"", ""));
+ if (_LOGI_ENABLED()) {
+ const char *req_str =
+ NM_IS_IPv4(priv->addr_family)
+ ? nm_dhcp_option_request_string(AF_INET, NM_DHCP_OPTION_DHCP4_NM_IP_ADDRESS)
+ : nm_dhcp_option_request_string(AF_INET6, NM_DHCP_OPTION_DHCP6_NM_IP_ADDRESS);
+ const char *addr = nm_g_hash_table_lookup(options, req_str);
+
+ _LOGI("state changed %s -> %s%s%s%s",
+ state_to_string(priv->state),
+ state_to_string(new_state),
+ NM_PRINT_FMT_QUOTED(addr, ", address=", addr, "", ""));
+ }
priv->state = new_state;
g_signal_emit(G_OBJECT(self), signals[SIGNAL_STATE_CHANGED], 0, new_state, ip_config, options);