mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 21:45:37 +00:00
[master] Merge branch 'trac4499'
This commit is contained in:
@@ -98,33 +98,15 @@ CfgHosts::getAllInternal(const Host::IdentifierType& identifier_type,
|
|||||||
const uint8_t* identifier,
|
const uint8_t* identifier,
|
||||||
const size_t identifier_len,
|
const size_t identifier_len,
|
||||||
Storage& storage) const {
|
Storage& storage) const {
|
||||||
// We will need to transform the identifier into the textual format.
|
|
||||||
// Until we do it, we mark it as invalid.
|
|
||||||
std::string identifier_text = "(invalid)";
|
|
||||||
try {
|
|
||||||
// Use Host object to find the textual form of the identifier.
|
|
||||||
// This may throw exception if the identifier is invalid.
|
|
||||||
Host host(identifier, identifier_len, identifier_type,
|
|
||||||
SubnetID(0), SubnetID(0), IOAddress::IPV4_ZERO_ADDRESS());
|
|
||||||
identifier_text = host.getIdentifierAsText();
|
|
||||||
|
|
||||||
} catch (...) {
|
// Convert host identifier into textual format for logging purposes.
|
||||||
// Suppress exception and keep using (invalid) as an
|
// This conversion is exception free.
|
||||||
// identifier. We will log that the identifier is
|
std::string identifier_text = Host::getIdentifierAsText(identifier_type,
|
||||||
// invalid and return.
|
identifier,
|
||||||
}
|
identifier_len);
|
||||||
|
|
||||||
// This will log that we're invoking this function with the specified
|
|
||||||
// identifier. The identifier may also be marked as (invalid) if it
|
|
||||||
// had 0 length or its type is unsupported.
|
|
||||||
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE, HOSTS_CFG_GET_ALL_IDENTIFIER)
|
LOG_DEBUG(hosts_logger, HOSTS_DBG_TRACE, HOSTS_CFG_GET_ALL_IDENTIFIER)
|
||||||
.arg(identifier_text);
|
.arg(identifier_text);
|
||||||
|
|
||||||
// Do nothing if the identifier specified is invalid.
|
|
||||||
if (identifier_text == "(invalid)") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use the identifier and identifier type as a composite key.
|
// Use the identifier and identifier type as a composite key.
|
||||||
const HostContainerIndex0& idx = hosts_.get<0>();
|
const HostContainerIndex0& idx = hosts_.get<0>();
|
||||||
boost::tuple<const std::vector<uint8_t>, const Host::IdentifierType> t =
|
boost::tuple<const std::vector<uint8_t>, const Host::IdentifierType> t =
|
||||||
|
Reference in New Issue
Block a user