dhcp-manager: move the options logging one level up

It will make sense to log the options even if we're not creating an
ip6_config (e.g. we got a prefix option, not an address).

Also, guard it with a logging enable conditional. That way we save
precious microseconds so that we'll feel less guilty about the demise of
mankind and universe.
This commit is contained in:
Lubomir Rintel 2016-10-27 16:09:38 +00:00
parent d74e5e45e5
commit 7d195856cc
2 changed files with 9 additions and 8 deletions

View file

@ -741,6 +741,15 @@ 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 */
g_warn_if_fail (g_hash_table_size (str_options));
if (g_hash_table_size (str_options)) {

View file

@ -615,8 +615,6 @@ nm_dhcp_utils_ip6_config_from_options (int ifindex,
struct in6_addr tmp_addr;
NMPlatformIP6Address address;
char *str = NULL;
GHashTableIter iter;
gpointer key, value;
g_return_val_if_fail (options != NULL, NULL);
@ -624,12 +622,6 @@ nm_dhcp_utils_ip6_config_from_options (int ifindex,
address.plen = 128;
address.timestamp = nm_utils_get_monotonic_timestamp_s ();
g_hash_table_iter_init (&iter, options);
while (g_hash_table_iter_next (&iter, &key, &value)) {
_LOG2D (LOGD_DHCP6, iface, "(%s): option '%s'=>'%s'",
iface, (const char *) key, (const char *) value);
}
ip6_config = nm_ip6_config_new (ifindex);
str = g_hash_table_lookup (options, "max_life");