networkd-dhcp6: Improve logging on DHCPv6 PD assignment
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 24 Aug 2018 15:49:22 +0000 (09:49 -0600)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 24 Aug 2018 15:53:46 +0000 (09:53 -0600)
Print out prefixes assigned to links in addition to the DHCPv6
prefix it was delegated from.

src/network/networkd-dhcp6.c

index c55fe62..0aa7a19 100644 (file)
@@ -121,6 +121,7 @@ static int dhcp6_pd_prefix_distribute(Link *dhcp6_link, Iterator *i,
         union in_addr_union prefix;
         uint64_t n_prefixes, n_used = 0;
         _cleanup_free_ char *buf = NULL;
+        _cleanup_free_ char *assigned_buf = NULL;
         int r;
 
         assert(manager);
@@ -158,19 +159,23 @@ static int dhcp6_pd_prefix_distribute(Link *dhcp6_link, Iterator *i,
                 if (assigned_link != NULL && assigned_link != link)
                         continue;
 
+                (void) in_addr_to_string(AF_INET6, &prefix, &assigned_buf);
                 r = dhcp6_pd_prefix_assign(link, &prefix.in6, 64,
                                            lifetime_preferred, lifetime_valid);
                 if (r < 0) {
-                        log_link_error_errno(link, r, "Unable to %s prefix %s/%u for link: %m",
+                        log_link_error_errno(link, r, "Unable to %s prefix %s/64 from %s/%u for link: %m",
                                              assigned_link ? "update": "assign",
+                                             strnull(assigned_buf),
                                              strnull(buf), pd_prefix_len);
 
                         if (assigned_link == NULL)
                                 continue;
 
                 } else
-                        log_link_debug(link, "Assigned prefix %" PRIu64 "/%" PRIu64 " %s/64 to link",
-                                       n_used + 1, n_prefixes, strnull(buf));
+                        log_link_debug(link, "Assigned prefix %" PRIu64 "/%" PRIu64 " %s/64 from %s/%u to link",
+                                       n_used + 1, n_prefixes,
+                                       strnull(assigned_buf),
+                                       strnull(buf), pd_prefix_len);
 
                 n_used++;