diff options
author | Marcin Siodelski <marcin@isc.org> | 2015-04-16 12:14:15 +0200 |
---|---|---|
committer | Marcin Siodelski <marcin@isc.org> | 2015-04-16 12:14:15 +0200 |
commit | 82600b5611d6fe1978accaefe6b42b77cee18f4f (patch) | |
tree | 031f49aef7f0344f6473f02b029ee3614d50ac79 /src/lib/dhcpsrv/cfg_hosts.cc | |
parent | [3699] Merge branch 'trac3699' of ssh://git.kea.isc.org/git/kea into trac3699 (diff) | |
download | kea-82600b5611d6fe1978accaefe6b42b77cee18f4f.tar.xz kea-82600b5611d6fe1978accaefe6b42b77cee18f4f.zip |
[3699] Added more traces to the CfgHosts class.
Diffstat (limited to 'src/lib/dhcpsrv/cfg_hosts.cc')
-rw-r--r-- | src/lib/dhcpsrv/cfg_hosts.cc | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/lib/dhcpsrv/cfg_hosts.cc b/src/lib/dhcpsrv/cfg_hosts.cc index 988efac4ec..7f76e34768 100644 --- a/src/lib/dhcpsrv/cfg_hosts.cc +++ b/src/lib/dhcpsrv/cfg_hosts.cc @@ -81,7 +81,34 @@ void CfgHosts::getAllInternal(const std::vector<uint8_t>& identifier, const Host::IdentifierType& identifier_type, Storage& storage) const { - // HOST_RESRV_GET_ALL_IDENTIFIER + // 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)"; + if (!identifier.empty()) { + try { + // Use Host object to find the textual form of the identifier. + // This may throw exception if the identifier is invalid. + Host host(&identifier[0], identifier.size(), identifier_type, + SubnetID(0), SubnetID(0), IOAddress::IPV4_ZERO_ADDRESS()); + identifier_text = host.getIdentifierAsText(); + + } catch (...) { + // Suppress exception and keep using (invalid) as an + // identifier. We will log that the identifier is + // invalid and return. + } + + } + // 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) + .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. const HostContainerIndex0& idx = hosts_.get<0>(); |