networkd-dhcp6: Improve logging on DHCPv6 PD assignment

Print out prefixes assigned to links in addition to the DHCPv6
prefix it was delegated from.
This commit is contained in:
Patrik Flykt 2018-08-24 09:49:22 -06:00
parent ef5df4e5c5
commit eb75b919e8
1 changed files with 8 additions and 3 deletions

View 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++;