diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index 0722981..5a19373 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -35,6 +35,7 @@ #include "nm-ip4-config-glue.h" #include "nm-dbus-glib-types.h" +#include "nm-logging.h" G_DEFINE_TYPE (NMIP4Config, nm_ip4_config, G_TYPE_OBJECT) @@ -650,6 +651,16 @@ nm_ip4_config_to_rtnl_addr (NMIP4Config *config, guint32 i, guint32 flags) success = (ip4_addr_to_rtnl_broadcast (bcast, addr) >= 0); } +{ +char buf[1024]; +char buf2[INET_ADDRSTRLEN]; +struct in_addr a = { .s_addr = nm_ip4_address_get_address (config_addr) }; +nl_object_dump_buf ((struct nl_object *) addr, buf, sizeof (buf) - 1); +buf[1023] = 0; +inet_ntop (AF_INET, &a, buf2, sizeof (buf2)); +nm_log_warn (LOGD_IP4, "%s: created '%s' from '%s/%d' flags 0x%X", __func__, buf, buf2, nm_ip4_address_get_prefix (config_addr), flags); +} + if (!success) { rtnl_addr_put (addr); addr = NULL; diff --git a/src/nm-system.c b/src/nm-system.c index 3998342..64be89a 100644 --- a/src/nm-system.c +++ b/src/nm-system.c @@ -196,6 +196,8 @@ sync_addresses (int ifindex, /* Walk through the cache, comparing the addresses already on * the interface to the addresses in addrs. */ +nm_log_warn (LOGD_IP4, "%s: comparing existing addresses", __func__); + for (match = nl_cache_get_first (addr_cache); match; match = nl_cache_get_next (match)) { gboolean buf_valid = FALSE; match_addr = (struct rtnl_addr *) match; @@ -211,6 +213,7 @@ sync_addresses (int ifindex, } if (addrs[i]) { +nm_log_warn (LOGD_IP4, "%s: address %d already exists", __func__, i); /* match == addrs[i], so remove it from addrs so we don't * try to add it to the interface again below. */ @@ -222,6 +225,13 @@ sync_addresses (int ifindex, nladdr = rtnl_addr_get_local (match_addr); +{ +char buf2[1024]; +nl_object_dump_buf ((struct nl_object *) match_addr, buf2, sizeof (buf2) - 1); +buf2[1023] = 0; +nm_log_warn (LOGD_IP4, "%s: no match for existing %s", __func__, buf2); +} + /* Don't delete IPv6 link-local addresses; they don't belong to NM */ if (rtnl_addr_get_family (match_addr) == AF_INET6) { struct in6_addr *tmp; @@ -276,7 +286,7 @@ sync_addresses (int ifindex, } if (buf_valid) { - nm_log_dbg (log_domain, "(%s): adding address '%s/%d'", + nm_log_warn (log_domain, "(%s): adding address '%s/%d'", iface, buf, nl_addr_get_prefixlen (nladdr)); } @@ -333,6 +343,12 @@ add_ip4_addresses (NMIP4Config *config, int ifindex) } addrs[i] = nm_ip4_config_to_rtnl_addr (config, i, flags); +{ +char buf[1024]; +nl_object_dump_buf ((struct nl_object *) addrs[i], buf, sizeof (buf) - 1); +buf[1023] = 0; +nm_log_warn (LOGD_IP4, " %i: %s", i, buf); +} if (!addrs[i]) { nm_log_warn (LOGD_DEVICE | LOGD_IP4, "(%s): couldn't create rtnl address!", @@ -408,11 +424,14 @@ nm_system_apply_ip4_config (int ifindex, g_return_val_if_fail (ifindex > 0, FALSE); g_return_val_if_fail (config != NULL, FALSE); +nm_log_warn (LOGD_IP4, "%s: applying IPv4 config for ifindex %d", __func__, ifindex); + if (flags & NM_IP4_COMPARE_FLAG_ADDRESSES) { if (!add_ip4_addresses (config, ifindex)) return FALSE; sleep (1); } +nm_log_warn (LOGD_IP4, "%s: DONE applying IPv4 config", __func__); if (flags & NM_IP4_COMPARE_FLAG_ROUTES) { for (i = 0; i < nm_ip4_config_get_num_routes (config); i++) {