mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-05 09:17:44 +03:00
networkd: improve logging
This commit is contained in:
parent
e7ab854c6c
commit
4058d339f5
@ -2706,9 +2706,8 @@ int link_save(Link *link) {
|
||||
sd_dhcp6_lease *dhcp6_lease = NULL;
|
||||
|
||||
if (link->dhcp6_client) {
|
||||
r = sd_dhcp6_client_get_lease(link->dhcp6_client,
|
||||
&dhcp6_lease);
|
||||
if (r < 0)
|
||||
r = sd_dhcp6_client_get_lease(link->dhcp6_client, &dhcp6_lease);
|
||||
if (r < 0 && r != -ENOMSG)
|
||||
log_link_debug(link, "No DHCPv6 lease");
|
||||
}
|
||||
|
||||
|
@ -577,9 +577,7 @@ int manager_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message,
|
||||
|
||||
r = sd_netlink_message_read_cache_info(message, IFA_CACHEINFO, &cinfo);
|
||||
if (r >= 0) {
|
||||
if (cinfo.ifa_valid == CACHE_INFO_INFINITY_LIFE_TIME)
|
||||
valid_str = "ever";
|
||||
else
|
||||
if (cinfo.ifa_valid != CACHE_INFO_INFINITY_LIFE_TIME)
|
||||
valid_str = format_timespan(valid_buf, FORMAT_TIMESPAN_MAX,
|
||||
cinfo.ifa_valid * USEC_PER_SEC,
|
||||
USEC_PER_SEC);
|
||||
@ -590,7 +588,8 @@ int manager_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message,
|
||||
switch (type) {
|
||||
case RTM_NEWADDR:
|
||||
if (address)
|
||||
log_link_debug(link, "Updating address: %s/%u (valid for %s)", buf, prefixlen, valid_str);
|
||||
log_link_debug(link, "Updating address: %s/%u (valid %s%s)", buf, prefixlen,
|
||||
valid_str ? "for " : "forever", valid_str ?: "");
|
||||
else {
|
||||
/* An address appeared that we did not request */
|
||||
r = address_add_foreign(link, family, &in_addr, prefixlen, &address);
|
||||
@ -598,7 +597,8 @@ int manager_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message,
|
||||
log_link_warning_errno(link, r, "Failed to add address %s/%u: %m", buf, prefixlen);
|
||||
return 0;
|
||||
} else
|
||||
log_link_debug(link, "Adding address: %s/%u (valid for %s)", buf, prefixlen, valid_str);
|
||||
log_link_debug(link, "Adding address: %s/%u (valid %s%s)", buf, prefixlen,
|
||||
valid_str ? "for " : "forever", valid_str ?: "");
|
||||
}
|
||||
|
||||
address_update(address, flags, scope, &cinfo);
|
||||
@ -608,10 +608,12 @@ int manager_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message,
|
||||
case RTM_DELADDR:
|
||||
|
||||
if (address) {
|
||||
log_link_debug(link, "Removing address: %s/%u (valid for %s)", buf, prefixlen, valid_str);
|
||||
log_link_debug(link, "Removing address: %s/%u (valid %s%s)", buf, prefixlen,
|
||||
valid_str ? "for " : "forever", valid_str ?: "");
|
||||
address_drop(address);
|
||||
} else
|
||||
log_link_warning(link, "Removing non-existent address: %s/%u (valid for %s)", buf, prefixlen, valid_str);
|
||||
log_link_warning(link, "Removing non-existent address: %s/%u (valid %s%s)", buf, prefixlen,
|
||||
valid_str ? "for " : "forever", valid_str ?: "");
|
||||
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user