1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

dhcp6: add debug logs

This commit is contained in:
Yu Watanabe 2019-11-17 23:57:50 +09:00
parent 944e23b8a0
commit a339859f79

View File

@ -232,7 +232,7 @@ static int dhcp6_client_set_duid_internal(
if (r < 0) {
r = dhcp_validate_duid_len(duid_type, duid_len, false);
if (r < 0)
return r;
return log_dhcp6_client_errno(client, r, "Failed to validate length of DUID: %m");
log_dhcp6_client(client, "Setting DUID of type %u with unexpected content", duid_type);
}
@ -243,32 +243,32 @@ static int dhcp6_client_set_duid_internal(
switch (duid_type) {
case DUID_TYPE_LLT:
if (client->mac_addr_len == 0)
return -EOPNOTSUPP;
return log_dhcp6_client_errno(client, SYNTHETIC_ERRNO(EOPNOTSUPP), "Failed to set DUID-LLT, MAC address is not set.");
r = dhcp_identifier_set_duid_llt(&client->duid, llt_time, client->mac_addr, client->mac_addr_len, client->arp_type, &client->duid_len);
if (r < 0)
return r;
return log_dhcp6_client_errno(client, r, "Failed to set DUID-LLT: %m");
break;
case DUID_TYPE_EN:
r = dhcp_identifier_set_duid_en(&client->duid, &client->duid_len);
if (r < 0)
return r;
return log_dhcp6_client_errno(client, r, "Failed to set DUID-EN: %m");
break;
case DUID_TYPE_LL:
if (client->mac_addr_len == 0)
return -EOPNOTSUPP;
return log_dhcp6_client_errno(client, SYNTHETIC_ERRNO(EOPNOTSUPP), "Failed to set DUID-LL, MAC address is not set.");
r = dhcp_identifier_set_duid_ll(&client->duid, client->mac_addr, client->mac_addr_len, client->arp_type, &client->duid_len);
if (r < 0)
return r;
return log_dhcp6_client_errno(client, r, "Failed to set DUID-LL: %m");
break;
case DUID_TYPE_UUID:
r = dhcp_identifier_set_duid_uuid(&client->duid, &client->duid_len);
if (r < 0)
return r;
return log_dhcp6_client_errno(client, r, "Failed to set DUID-UUID: %m");
break;
default:
return -EINVAL;
return log_dhcp6_client_errno(client, SYNTHETIC_ERRNO(EINVAL), "Invalid DUID type");
}
return 0;